Replace a Character in the Query output..

Hi all,
I have a query which returns an output like the following
Field 1
29-0138392-00200
29-0138392-00200
29-0138392-00200
21-1774692-00210
21-1774692-00210
21-1774692-00210
21-1774692-00304
21-1774692-00304
I want to format it into as follows
29-0138392-A0200
29-0138392-B0200
29-0138392-C0200
29-0138392-D0200
21-1774692-A0210
21-1774692-B0210
21-1774692-C0210
21-1774692-A0304
21-1774692-B0304
How to Acheive this....?

I have got little bit different table but result should be the same:
      COL1 COL2       COL3
         1 S1         13/01/2006
         1 S2         13/01/2006
         1 S1         14/01/2006
         2 S1         13/01/2006
         2 S2         13/01/2006
         2 S1         14/01/2006
6 rows selected.I would like to add to col1 letters.
I wrote this query:
  1  SELECT B1.COL1, B2.COL1, CASE WHEN RN > COUNT THEN
  2                             CHR(64 + (RN - COUNT)) || B1.COL1 ELSE CHR(64 +
RN) || B1.COL1 END AS RESULT, COUNT
  3  FROM (SELECT COL1, ROWNUM AS RN
  4     FROM TABLEB) B1,
  5       (SELECT COL1, COUNT(1) AS COUNT
  6     FROM TABLEB
  7     GROUP BY COL1) B2
  8* WHERE B1.COL1=B2.COL1;And the effect:
      COL1       COL1 RESULT                                            COUNT
         1          1 A1                                                    3
         1          1 B1                                                    3
         1          1 C1                                                    3
         2          2 A2                                                    3
         2          2 B2                                                    3
         2          2 C2                                                    3
6 rows selected.As you can see RESULT column has values from COL1 and letter in front of it starting from A to ROW COUNT.
Hope this help
Peter D.

Similar Messages

  • How to replace # in the query output ?

    Hi experts,
    In the query output and for a particular field in a record if there is no value then it is displaying as '#'.
    Can  we replace '#' with any text or with any other value ?
    Regards,
    Nishuv V.

    hello,
    if you display the characteristics as Key u will get as '#'.
    You can select as Text,then it will show 'Not Assigned'.
    Further, check on these threads:
    How to replace '#' with blank when there is no value for a date field
    Re: How to replace display attribute Value '0', instead of '#' in the query
    Reg,
    Dhanya

  • Central Management server - executed a query but how to send the query output in the form of mail?

    Hi All,
    i have used CMS in SQL 2008 R2. i have added couple of servers in its group. i have executed a query & i need to send the query output in the form of email.
    basically query is checking the rows count from couple of user tables in servers.
    issue here is how to copy the data that is used by CMS? i need to work on automate the rows count in difft user table in db servers
    could you please suggest how can i achieve this?

    Copy to what?
    SELECT COUNT(*) FROM sys.objects
    Running the above statement returns two columns (server name and count)
    All the servers SS2005  and onwards , then use
    EXEC msdb.dbo.sp_send_dbmail 
         @profile_name = 'name', 
         @recipients = '[email protected]', 
         @query = 'SELECT COUNT(*) FROM sys.objects', 
         @subject = 'Count rows'
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • ERROR displaying in the query output... urgetn

    hi experts,
    For the amount keyfigures in the query output it displaying ERROR after the amount like ex- 2000 ERROR.
    plz let me know how to rectify this..
    regards
    vadlamudi

    hi,
    i have created only two keyfigures EMP_BASIC and EMP_HRA. and in the transformations i have mapped with 0DOC_CURRCY.
    but in the report its showing ERROR only after the amount. plz tell me exactly with what field i need to map???
    regards
    vadlamudi

  • How to get the Query output to Excel

    Hi ,
    Can you tell me how to get the Query output to excel with out using any third party tool?
    Can you tell me how to write the code in Webservice and call it..
    Please explain it Elaboartly..
    Thanks in Advance!!!
    Mini

    whats your source system?
    you can use Live office, or query as a webservice if you are getting data from universe
    if you're getting data from SAP BI query and you have a java stack on your netweaver then you can get the data directly using sap bi connector in xcelsius.
    good luck

  • Want to See Selected Input Variables in the query output

    Hi al
    My client gives a requirment like they want to see selected variables in the query output. Like suppose if i am  entering Profit center, controlling area, version, caldayas a input on the screen. Now they want to see only Profit center and version on the query result.
    Please let me know if any one has this solution.
    Regards,
    Amit Shetye

    Hi
    Can you please give us user requirement and according to ure requirement so we given replies . If ure requirement please explain detail
    But it is not neccessary that we can put something in free char and all. Inspite of that they wanted to select the input variable as per their requirement. They dont want to restrict them in Free char.

  • How to display header title for 0MATERIAL texts in the query output?

    Dear Bwers,
    I have a requirement where i need to display headers titles for 0MATERIAL texts in the query output. (example "Material description"). Any ideas on how to do this?
    Thanks
    Raj

    Kamal,
    Its is as below:
    <b>Vendor</b>    <b>Vendor Name</b>
    1001 ---            Bright Industries
    1002 ---            Glow Industries
    I want to display the header title "Vendor Name" as the  title in the column instead of displaying the text without any header title.
    Thanks
    Raj
    Message was edited by:
            Raj Singh
    Message was edited by:
            Raj Singh

  • Anyway to supress the coulmn names in the query output from SQLPLUS

    Hi,
    I am using sqlplus to run a script which returns the results with column names.
    Is there anyway to omit the column names from the query output from sqlplus?
    I would like to have only results with out their column names in the output.
    Thanks in advance!!

    Hi,
    Maybe your LINES(IZE) isn't set ?
    SCOTT>set lines 130
    SCOTT>select status, machine, module
      2    from v$session
      3   where upper(username) = 'SCOTT';
    STATUS   MACHINE                                                          MODULE
    INACTIVE PFAE3\VPC4894-03                                                 TOAD 9.7.2.5
    ACTIVE   PFAE3\VPC4894-03                                                 SQL*Plus
    2 rows selected.
    SCOTT>As an alternative to setting linesize, you can format columns:
    SCOTT>set lines 80
    SCOTT>col status for a8
    SCOTT>col machine for a30
    SCOTT>col module for a30
    SCOTT>select status, machine, module
      2    from v$session
      3   where upper(username) = 'SCOTT';
    STATUS   MACHINE                        MODULE
    INACTIVE PFAE3\VPC4894-03               TOAD 9.7.2.5
    ACTIVE   PFAE3\VPC4894-03               SQL*Plus
    2 rows selected.
    SCOTT>Regards
    Peter

  • Suppress zero rows in the query output.

    Dear Experts,
    We executed a query. In the output the values are displayed based on a hierarchy on gl account.
    But in the output some rows dont have any values i.e 0 value. Still those rows are appearing in the report output.I want to
    supress entire row. How to supress the entire row if no value i.e zeros are appearing in the query output.
    Regards,
    Bhadri M.

    go to change mode of query
    in that set the query properties /go to the query property secreen
    in the "Display " tab set the supperssion as "active (all value=0)" and in structure properties select the check box "also use  zero suppression for strucure element"
    i think it will be help ful
    Edited by: Soma Venkateshwarlu on Aug 28, 2009 2:40 PM

  • Result Row in the query output

    Hi,
    If I restrict a characteristic by hierarchy then I can’t have the result row displayed. If the hierarchy active is removed then the result row gets displayed. All characteristics are marked to show the result row.
    This characteristic is Account Number. If in the query definition I remove the restriction on account numbers and just select hierarchy active and the required hierarchy in the properties then I get the result row in the output. But now it also displays all the unassigned account numbers in a separate node “Not Assigned Account Number (s)”.
    I can’t even restrict it in the output with hierarchy active selected. When I do select filter value in the output the options Include in Selection and exclude from Selection are grayed out and hence can’t select it.
    Please advice on this issue…
    Thank you,
    sam

    Hi Jaya,
    I think you misunderstood my issue.
    My problem is not that i do not want to see the field. But instead, i do not want to see only the results row in the query output.
    I need to have the results to populate a calculation via sumct formula.
    My question is, can sumct be populated if i hide/supress RESULT row ?
    Regards,
    Maili

  • Issue with Saving the Query output data in Excel format

    Hi,
    Recnetly we had upgraded from 4.6c to ECC 6.0.
    In ECc 6.0 environment, when user try to export the query output , we are getting only XML option to save the data.
    But user want to save the data in EXcel format, he was able to do that in 4.6C.
    pleas eprovide some inputs, on this issue.
    Thanks,
    Sanketh.

    I cannot for the life of me imagine, why a link to a post in the 'Business One Forum' where one uses ODBC to transfer query-data to MicroSoft Excel is of relevance to the OPs question, even if the same is not a security issue.
    Never mind. [note 40155|https://service.sap.com/sap/support/notes/402155] deals with various symptoms in the ALV-Excel combination as as of release 4.6C. There are various others, mostly in components BC-SRV-ALV and BC-ABA-LI - also: I remember that when we upgraded from 4.5B to 4.7C there was an issue with Excel-templates -> the solution was in the release notes somewhere. So, in addition to SMP you might want to check the release notes and/or upgrade guide for solutions.
    And yes, moderators ... this is not a security issue, this should go to ECC-Applications/Upgrade.

  • Data Error in the Query Output

    Hi Experts
    Could you please advise me how to proceed.....and impact of Aggregates
    I had a Query based on a Multicube which in turn is based on 4 Infocubes
    IC1-North,
    IC2-South,
    IC3-EAST,
    IC4-WEST.
    I had Aggregates developed on
    IC1-North,
    IC2-South,
    IC4-WEST.
    Data is loaded according to Location to the respective cubes
    When i execute query based on Multicube...in the variable screen i had a user entry variable...when i select the drop down list of avaliable Location...the list doesn't contain EAST as a Location ID and also when i execute the query with out location it is not displaying IC3-EAST data in the output
    Could you please update me ...what might be the reason of the problem and how to proceed
    Thanks

    Hi Venkat,
    No i haven't done anything on aggregates before or after selective delete
    As there is not data load after the selective delete according to SAP Manual we don't need to perform any thing on aggregates...as selective data deletion on cube will delete data from aggregates as well
    Please update how to identify error

  • To download the query output to falt file

    Hi all,
    i have a query which i know will give more than 65k records as the output for a selection.
    i cannot run this query in excel due to its limitation.
    if i run on web i cannot download this as downloading is happening to excel file only.
    The customer ideally wants to download the query result to a text file(csv,tab-delimited etc) which inturn it will upload to MS-Access.
    How do i achieve this?
    SAP has given response use try using these options:
    1.open interfaces to receive the output of a query via the MDX language.
    2.open hub tool as it is designed for big amounts of data.(i suppose this is not possible as i want to download query output not the data target contents)
    how do i achieve my scenario with option 1?
    Are there any alternatives??
    Any useful help will be rewarded.
    Regards,
    Dhanya.

    hi vivek,
    thnks for the useful reply.
    i have some problem with my ID,hence loggin in through my coleague's ID.
    i will assign u points as i get logged in.
    I did as u said by downloading it to unconverted format.
    the file got download to a text file.where the output has
    1.header rows(10 lines almost)
    2.the values r coming in single quotes e,g:
    '144000023073      'TAAS SETTLEMENT CONV 738 '19333000   '30.09.2006          '0.000
    how can i remove all this?
    Regards,
    Dhanya
    I

  • Replace a character in the string using JavaScript

    Hello,
    I would like to ask for help. I have a field in the xml file, which contains a string, that is bound to a text box on the form.
    What would be the syntax to replace a special character in the string with the carriage return?
    Thank you.

    Huh?
    I didn't post my script...
    It sure is no clean programming since I just took Steve's solutions and delted the ligns I didn't want (the app allert)
    Though in the end I've taken the boolean out, or better replaced it with the replacement function, it repeats the replacement no matter how much "ü"'s are in there. (I needed the boolean though, since as long as it was true, the if should be executed.)
    Somehow it worked... not 100% sure why, but it worked.
    if (findChar(this.rawValue)) {
    function findChar(str)
    {  for (var i=0; i < str.length; i++)
            if (str.charAt(i) == "ü")
               this.rawValue = this.rawValue.replace(/ü/,"ue")

  • How to limit the records in the query output

    Hi Experts,
    I have key figures A,B, and C. I want to get the output which shows the key figures B and C values, where values for key figures A is equal to zero.
    Any help is much appreciated.
    Thanks,

    Kishore,
          Instead of pulling the keyfigures B and C in the report, create two formulas. For B, define the formula as (A==0)B. For C, define (A==0)C.
    This will show B and C values only when A is equal to 0, when A is not  0 the values of B and C are shown 0. If you  dont want to show B and C when A is not 0, go to the query properties and suppress zeroes for columns.
    Hope this helps...

Maybe you are looking for

  • Need some help about i18n on Redhat 71. with Oracle 8.1.7

    Initally I used Redhat 7.0 with Oracle 8.1.7, everything had worked find until I upgrade my system to Redhat 7.1. I have no idea about Redhat locate setting. Well, I use NLS_LANG=TRADITIONAL CHINESE_TAIWAN.ZHT16BIG5 to inital database . some characte

  • Error while testing the webservice through SOAMANAGER

    Hi All, I have created a webservice from a Function module ( RFC enabled). I am getting an error while testing the webservice from the SOAMANAGER but the function module is working fine giving proper output. The error is REQUEST: POST /sap/bc/srt/rfc

  • Error loading class problem with applet (Newbie)

    Hi, I am new to Java applets. I try to display a simple sample. I put this into html file: <APPLET codebase="classes" code="NewApplet.class" width=350 height=200></APPLET> And it always appears one problem: Error loading class: NewApplet java.lang.No

  • Need help with DBMS_PROFILER

    For some reason the profiler doesn't seem to be working. The user that I am logged in has select/insert/delete on the following profiler tables: SYS.PLSQL_PROFILER_DATA SYS.PLSQL_PROFILER_RUNS SYS.PLSQL_PROFILER_UNITS I am also able to perform a desc

  • RUNAS account - Specified Cast is invalid.

    When I attempt to look at the properties of a RUNAS account for SQL Server alerting / monitoring which I recently updated to add a new sql server in the distributionl, I get the following error. Eventually it will come up but the distribution list of