How do Excute the following Query?

select 1 where 1 =1

select 1 where 1 =1
Hi Selvam,
I strongly recommend you describe your issue or requirement with more detail, it's helpful for the community members to help you in a more efficient way.
Regards,
Elvis Long
TechNet Community Support

Similar Messages

  • How to convert the following query to sql server 2005

    hi
    i have the following query in ms access and i want to convert it into sql server 2005 express edition
    SELECT iif(Max(BNo) is null,1,Max(BNo)+1) AS BNo from ( SELECT iif(Max(Product.BNo) is null,0,Max(Product.BNo)) AS BNo FROM Product union all SELECT iif(Max(grndetail.BNo) is null,0,Max(grndetail.BNo)) AS BNo FROM grndetail UNION ALL SELECT iif(Max(srdetail.BNo) is null,0,Max(srdetail.BNo)) AS BNo FROM srdetail ) as t
    how to do this

    The construct involving case when MAX sounds suspicious. Can you explain what the query is supposed to be doing, the structure of your table, then we can re-write it?
    E.g. if you provide your table, some data and desired result, you'll get better answer than direct translation of this suspicious query.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to enhance the following query?

    Hi all,
              I am using the following piece of code to some fields from table STAS.However this query is taking a long time to execute.
    Can anyone please tell me how can i enhance it so that it may execute faster?Thnx in advance.
    LOOP AT IT_FG WHERE STLAL = ' '.                                   
      SELECT STLAL FROM STAS
      INTO IT_FG-STLAL
      WHERE STLNR = IT_FG-STLNR
        AND STLKN = IT_FG-STLKN.                                         
      MODIFY IT_FG.                                                    
      ENDSELECT.                                                       
    ENDLOOP.
    Regards,
    S.choudhury.
    Edited by: Rob Burbank on Dec 23, 2009 12:02 PM

    The above recommendation are only o.k., if you use sorted tables. However, maybe people don't mention because you should always use sorted tables. I am joking, but the recommendation is true!
    Otherwise use binary search, but better use sorted tables!
    And for the loop you should use ASSIGNING which speeds up the modify.
    field-symbols: <fs>   type it_fg.
    SELECT STLAL STLNR STLKN
                  INTO table IT_new
                  FROM STAS
                  for all entries in  IT_FG
                  WHERE STLNR = IT_FG-STLNR
                  AND STLKN = IT_FG-STLKN.
    SORT it_new BY stlnr stlkn.
    LOOP AT IT_FG ASSIGNING <fs>
              WHERE STLAL = ' '.
         read table  IT_new 
                 into wa_new
                 WITH KEY STLNR = IT_FG-STLNR
                  AND STLKN         = IT_FG-STLKN
                 BINARY SEARCH.
    * type ???.
          <fs> = wa_new-STLAL.
    ENDLOOP.

  • How to add a receipt number in the following Query for PO Report

    Hi Guys,
    I need a help regarding following query.
    Its a PO report for 11.5.10.2
    select distinct pv.segment1 supplier_number,
    pv.vendor_name supplier_name,
    pha.segment1 po_number,
    pha.revision_num revision_num,
    pha.authorization_status po_status,
    to_char(pha.creation_date, 'DD/MM/YYYY') creation_date,
    pha.currency_code currency_code,
    pla.sum_amount_ordered sum_amount_ordered,
    pda.sum_quantity_ordered sum_quantity_ordered,
    pda.sum_amount_received sum_amount_received,
    pda.sum_quantity_received sum_quantity_received,
    (pla.sum_amount_ordered - pda.sum_amount_received) sum_accrued, --AVI
    ( pda.sum_quantity_ordered - pda.sum_quantity_received) quantity_accrued, --AVi
    to_char(rsl.date_receipt, 'DD/MM/YYYY') date_receipt,
    -- rsl.receipt_num receipt_number,
    ppa.segment1 project_code, ppa.project_status_code, --10.0.0.4
    aia.invoice_num invoice_num,
    aia.invoice_date invoice_date, --AVI 
    aia.creation_date invoice_creation_date, --AVI 
    aia.amount invoice_amount_allocated_to_po, --AVI
    pla.purchase_basis,
    pla.category_id,
    -- pda.item_description,
    haou.name organisation, --10.0.0.3
    pda.sum_quantity_billed sum_quantity_billed , --10.0.0.3
    gcc1.CONCATENATED_SEGMENTS,
    gcc2.CONCATENATED_SEGMENTS
    from po_headers_all pha,
    po_vendors pv,
    pa_projects_all ppa,
    hr_all_organization_units haou,
    (select po_header_id,
    sum(quantity * unit_price) sum_amount_ordered,
    org_id,
    purchase_basis,
    category_id
    -- pla.item_description,
    from po_lines_all
    group by po_header_id, org_id
    , purchase_basis,
    category_id
    -- pla.item_description
    ) pla,
    (select pla.po_header_id,
    pda.project_id,
    sum(pda.quantity_ordered) sum_quantity_ordered,
    sum(pda.quantity_delivered * pla.unit_price) sum_amount_received,
    sum(pda.quantity_delivered) sum_quantity_received,
    sum(pda.quantity_billed) sum_quantity_billed, --10.0.0.3
    accrual_account_id
    from po_distributions_all pda, po_lines_all pla
    where pla.po_line_id = pda.po_line_id
    group by pla.po_header_id, pda.project_id,accrual_account_id
    ) pda,
    (select po_header_id, charge_account_id,
    -- rsh.receipt_num,
    min(rsl.creation_date) date_receipt
    from rcv_shipment_lines rsl
    where rsh.SHIPMENT_HEADER_ID=rsl.SHIPMENT_HEADER_ID
    group by po_header_id,charge_account_id
    ) rsl,
    (select distinct aia.invoice_num, pda.po_header_id , aia.invoice_date --10.0.0.3
    , aia.creation_date , sum(aida.amount) amount
    from po_distributions_all pda,
    ap_invoice_distributions_all aida,
    ap_invoices_all aia
    where pda.po_distribution_id = aida.po_distribution_id(+)
    and aia.invoice_id(+) = aida.invoice_id
    Group by
    aia.invoice_num, pda.po_header_id , aia.invoice_date --10.0.0.3
    , aia.creation_date) aia,
    (select haou2.organization_id, haou2.name
    from fnd_flex_value_sets ffvs,
    fnd_flex_value_norm_hierarchy ffvnh,
    fnd_flex_values_vl ffvv,
    hr_all_organization_units haou1,
    FND_FLEX_VALUE_CHILDREN_V ffvcv,
    hr_all_organization_units haou2
    where ffvs.FLEX_VALUE_SET_NAME = 'CAP_CODE_BU'
    and ffvs.FLEX_VALUE_SET_ID = ffvnh.flex_value_set_id
    and ffvnh.parent_flex_value like 'PO%'
    and ffvv.FLEX_VALUE_SET_ID = ffvnh.flex_value_set_id
    and ffvv.FLEX_VALUE between ffvnh.child_flex_value_low and ffvnh.child_flex_value_high
    and substr(haou1.name, 1, Instr(haou1.name, '-')) =
    substr(ffvv.DESCRIPTION, 1, Instr(ffvv.DESCRIPTION, '-'))
    and haou1.organization_id = fnd_global.org_id
    and ffvcv.parent_flex_value = ffvnh.parent_flex_value
    and ffvcv.flex_value_set_id = ffvs.flex_value_set_id
    and substr(haou2.name, 1, Instr(haou2.name, '-')) =
    substr(ffvcv.DESCRIPTION, 1, Instr(ffvcv.DESCRIPTION, '-'))
    union --10.0.0.1
    select f.organization_id, f.name --10.0.0.1
    from hr_all_organization_units f --10.0.0.1
    where f.organization_id = fnd_global.ORG_ID --10.0.0.1
    ) bu
    , po_line_locations_all plla --10.0.0.4
    , gl_code_combinations_kfv gcc1
    ,gl_code_combinations_kfv gcc2
    where pv.vendor_id = pha.vendor_id
    and pla.po_header_id = pha.po_header_id
    and pda.po_header_id = pha.po_header_id
    and pha.po_header_id = rsl.po_header_id(+)
    and pda.project_id = ppa.project_id(+)
    and pha.po_header_id = aia.po_header_id(+)
    and aia.po_header_id = pha.po_header_id
    and pla.org_id = haou.organization_id
    and pha.authorization_status in ('APPROVED', 'OPEN')
    and plla.po_header_id = pha.po_header_id --10.0.0.4
    and plla.closed_code in ('APPROVED', 'OPEN', 'CLOSED FOR INVOICE', 'CLOSED FOR RECEIVING', 'CANCELLED') --10.0.0.4
    and bu.organization_id = haou.organization_id
    AND gcc1.code_combination_id = pda.accrual_account_id
    AND gcc2.code_combination_id =rsl.CHARGE_ACCOUNT_ID
    In the following query I have commented receipt_num using the table rcv_transaction_headers.
    If I uncomment it the query results huge number of unexpected report.
    How can I add receipt number to the following query?
    Should I use rcv_transactions. If yes, what would be the join conditions.
    Kindly help as its urgent.
    Thanks in advance.
    Regards
    Avijit

    Sandeep is correct. I don't have time to tell you the correct query, but mine is something like this based on Sandeep's information:
    SELECT rsh.receipt_num
    FROM   rcv_transactions      rcvt,
           po_lines_all          pla,
           rcv_shipment_headers  rsh
    WHERE  rcvt.shipment_header_id   = rsh.shipment_header_id
    AND    rcvt.PO_LINE_ID          = pla.PO_LINE_ID
    AND    pla.item_id              = (select distinct inventory_item_id
    from mtl_system_items
    where segment1 = '1216107-2')

  • How Can I make the following query faster

    Hi Guru
    I want your valuable suggestion to make the following query faster.I did not write all required columns list. I gave here all those columns where I have conditon like decode,case when,or subquery
    (SELECT CASE WHEN REPORTED_BY IS NULL THEN
              (SELECT INITCAP(EMP_NAME) FROM HR_EMP WHERE EMP_NO = M.EMP_NO_RADIO)
         ELSE (SELECT INITCAP(EMP_NAME) FROM HR_EMP WHERE EMP_NO = M.REPORTED_BY) END RADIOLOGIST_NAME,
         (SELECT TEAM_NAME FROM DC_TECHTEAMMST WHERE TEAM_NO = M.GROUP_NO) GROUP_NAME,
         CASE WHEN M.RESULT_ENTRY_LOCK_BY IS NOT NULL THEN 'R'
    WHEN M.REPORT_DONE = 'D' THEN 'D'
    WHEN M.REPORT_DONE = 'P' THEN 'P'
    WHEN M.REPORT_DONE = 'F' THEN 'F'
         WHEN NVL(M.IMG_CAPTURED,'X') NOT IN ('B','Y') OR M.QA_RESULT = 'F' THEN 'S'
    WHEN NVL(M.IMG_CAPTURED,'X') IN ('B','Y') AND NVL(M.QA_RESULT,'X') NOT IN ('B','P') THEN 'Q'
         wHEN NVL(M.IMG_CAPTURED,'X') IN ('B','Y') AND NVL(M.QA_RESULT,'X') IN ('B','P') THEN 'C'
    END STATUS,
         (SELECT DECODE(NVL(V.DELIVERY_STATUS,'N'),'E',3,'U',2,1)
              FROM FN_VOUCHERCHD V WHERE V.VOUCHER_NO = M.VOUCHER_NO AND V.ITEM_NO = M.TEST_NO) DELIVERY_STATUS,
         trunc((start_time-order_end)*24,0)||' hr'||':'||
         decode(length(trunc(to_char(MOD((M.start_time-M.order_end)*24,1)*60),0)),2,to_char(trunc(to_char(MOD((M.start_time-M.order_end)*24,1)*60),0))
              ,1,to_char('0'||trunc(to_char(MOD((M.start_time-M.order_end)*24,1)*60),0)))||' mi' duration_order_capture,
         DECODE(R.CONFIDENTIAL_PATIENT,'Y','*',NVL(R.NAME,R.name_lang_name||' '||R.name_lang_fname)) PAT_NAME,
         FNC_PATIENTAGE(R.REG_NO,'',R.CONFIDENTIAL_PATIENT) pat_age,
         DECODE(R.CONFIDENTIAL_PATIENT,'Y','*',R.PATIENT_SEX) PAT_SEX
    FROM DC_MODALITYAPPOINTMENT M,DC_TESTMST T,OP_REGISTRATION R
    WHERE M.ACCESSION_NO IS NOT NULL AND NVL(M.CANCEL_FLAG,'N') = 'N'
    AND (NVL(T.SP_GEN,'S') = 'S' OR NVL(M.DOC_REQ_GEN,'N') = 'Y')
    AND M.TEST_NO IS NOT NULL AND M.TEST_NO = T.TEST_NO AND M.REG_NO = R.REG_NO)
    How can I make the above query faster.
    Query condition or indexing whatever is preferable please guide me.
    The approximate data of tables
    DC_MODALITYAPPOINTMENT 2,000,000
    A lot of updating is going on some columns of this table.all columns are not in the select list, Insertion is happend in batch process by back-end trigger of another table.
    Primary key based one column,
    OP_REGISTRATION 500,000
    Daily insertion on this table around 500 records,updation is not much.
    Primary key based one column 'reg_no'
    DC_TESTMST
    Total records of this table not more than 1500.This is setup table. Insertion and updation is not much on this table also
    I have to create a view based on this query .
    and I have to create another view to serve another purpose.
    In the 2nd view I need this query as well as I need another query by using union all operator based on a table(dc_oldresult)
    which have 1,600,000 records.There is no DML on this table
    SELECT      NVL((SELECT USER_DEFINE_TEST_NO FROM DC_TESTMST WHERE TEST_NO = SV_ID AND ROWNUM = 1 ),SV_ID) USER_D_EXAM_NO,
    (SELECT TEST_TYPE FROM DC_TESTMST WHERE TEST_NO = SV_ID AND ROWNUM = 1 ) EXAM_TYPE,
         NVL((SELECT TEST_NAME FROM DC_TESTMST WHERE TEST_NO = SV_ID AND ROWNUM = 1),'Exam Code: '||sv_id) EXAM_NAME,
         (SELECT PAT_NAME FROM OP_REGISTRATION WHERE REG_NO = HN) PATIENT_NAME,
         (SELECT PAT_AGE FROM OP_REGISTRATION WHERE REG_NO = HN) PATIENT_AGE,
         (SELECT PAT_SEX FROM OP_REGISTRATION WHERE REG_NO = HN) PATIENT_GENDER
    FROM DC_OLDRESULT
    WHERE HN IS NOT NULL AND SV_ID IS NOT NULL AND UPPER(ACTIVE) = 'TRUE'
    Should I make join DC_OLDRESULT, OP_REGISTRATION and DC_TESTMST? or The eixisting subquery is better?
    I use OP_REGISTRATION and DC_TESTMST in both query
    Thanks in advance
    Mokarem

    When your query takes too long ...

  • How to Excute the BW Roles

    Hi All,
           How to excute the BW Queries in portal, if any body knows procedure pls reply to me....
    Regards,
    Jagadish Babu Kanikanti.

    Hi Jagdish
    check system setting in portal for BW.
    or do it by following.
    Creating BW system in Portal
    From the portal top-level navigation, choose System Administration -> System Configuration -> System Landscape
    Navigate to Portal Content -> Your SAP Ssytem Folder i.e SAP BW
    Right-click on the SAP BW folder, then choose New -> System
    Select SAP system using dedicated application server
    from System Template
    Make the following entries for the BW system you want to connect to the Enterprise Portal
    System Name -
    SAP_BW
    System ID -
    Any ting u want like SAP_BW or SID of BW
    System ID Prefix -
    com.mycompany
    Master Language -
    English
    Description -
    NEXT -> Summary, review the options you selected for the new page.To make changes, choose Back to return to the appropriate screen. Then choose Next till you reach the Summary page, review, and choose Finish
    Choose Open the object for editing and choose OK
    The Property Editor iView will open
    Select Connector in the Property Category dropdown
    Enter the fields below according to your SAP system
    Application Host -
    IP Address of BW system or Host name ( FQDN required for SSO )
    SAP Client --- BW system client
    SAP System ID -
    SID of BW
    Server Port -
    3200 default for system number 00
    SAP System Number -
    00 or ur instance number
    System Type -
    SAP_BW
    NOW,
    Select User Management from the Property Category dropdown list
    Enter the fields below
    Logon Method -
    UIDPW
    User Mapping Type --- Admin,user
    Note -: IF u want to use SSO for BW system first selct above and test it with BW system if it's ok than change to following
    Logon Method -
    SAPLOGONTICKET
    User Mapping Type --- Admin,user
    choose SAVE.
    Select System Aliases in the Edit dropdown list. This opens the System Alias Editor
    In Alias, enter SAP_BW. Choose the Add button
    Choose Save to save your changes and close the page
    Connect With ITS
    For BW
    In Property Catalog, use the dropdown to select ITS.
    Set your SAP system properties according to Following
    ITS Description -
    Description
    ITS Host Name -
    Host name : Port for BW system
    If u want to use SSO use FQDN instead of host name
    ITS Path -
    /scripts/wgate
    ITS Protocol -
    http
    Save your settings.
    u can check its for BW by following
    Find a port for BW using IIS manager
    Administrator tools -> Internet Service Manager - >
    extend the HOST
    Find the site created for BW system same like SID of BW system -> right click -> Properties
    TCP Port -- this is used for ur BW system
    in IE http://host_for_its:Port_for_bw/scripts/wgate/webgui/!
    WAS for BW System
    Select Web Application Server (WAS) in the Property Category dropdown list
    WAS Description -
    BW WAS
    WAS Host Name -
    Host name : Port for BW system
    use FQDN for SSO
    WAS Path -
    /SAP/BW/Bex
    WAS Protocol -
    http
    Save ur entry.
    User Management For BW and EP
    Befor u start if u don't use SAP Secu lib during installation
    change the following
    system Administration -> System configuration -> Um configuration -> Direct editing
    find out follwoing
    ume.usermapping.unsecure=False
    change to
    ume.usermapping.unsecure=TRUE
    Save and restart portal server
    ther are so many option available for DATA source u have required doc for using that
    if u have any query for that msg me back
    Mapping Users in the Portal
    if u want to use UIDPW than user must be map to BW system
    go by following
    User Administration -> User Mapping
    select the user u want to map by serch or entering a name
    Choose the Alias for your backend system, for example SAP_BW
    Enter the user id and password for BW user
    save ur changes.
    SSO configuration
    make sure ur Portal ITS and BW WAS system belong to Same
    domain.
    i.e
    portal.mycompany.com
    its.mycompany.com
    bw.mycompany.com
    if not, u can do by creating a alias into host file for corresponding system
    for SSO follwoing parameter must be set in profile parameter using RZ10 in BW system
    login/accept_sso2_ticket -
    1
    login/create_sso2_ticket -
    1
    login/ticket_expiration_time --- desired value default 60
    now download the portal certificate form follwoing
    System administration -> System configuration -> Keystore
    Administration
    donload verify.der file save it it's like verify.der.zip
    extract it than u can get verify.der
    now in BW system using trans. STRUSTSSO2
    in the certificate section choose import certificate
    choose the file tab enter the path of the portal's verify.der file
    set the file format to DER coded
    in the trust manager choose ADD to PSE and Choose
    ADD to ACL
    in the dialog box enter the portal system's id (SID) and client
    by default portla system ID is the common name (CN) and client is 000
    save ur entry and restart the BW server
    this are the basci configuration if u have any query related to it msg me back
    regards,
    kaushal

  • How to view the sql query?

    hi,
      how to view the sql query formed from the xml structure in the receiver jdbc?

    You can view SAP Note at
    http://service.sap.com/notes
    But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
    Reason and Prerequisites
    You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
    Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
    Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
    When you want to use a parameter documented here, please be aware to which category it belongs!
    Solution
    The following list shows all available parameters of category 1 or 2. Please note:
    Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
    Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
    The default value of a parameter is always chosen that it does not change the standard functionality
    JDBC Receiver Adapter Parameters
    1. Parameter name: "logSQLStatement"
                  Parameter type: boolean
                  Parameter value: true for any string value, false only for empty string
                  Parameter value default: false (empty String)
                  Available with: SP9
                  Category: 2
                  Description:
                  When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
                  This should be used only during the test phase and not in productive scenarios.
    Regards,
    Prateek

  • The following query failed: GetUserProfileByName - with the wrong username

    I have 2 users (out of 800), who run into this issue on occasion. Their username is 'fccs\user1' in the profile db, and in every UserInfo table in the system. But when they try to go to certain sites or open an infopath form, this error gets thrown:
    The following query failed: GetUserProfileByName (User: FCCS\[email protected], Form Name: Template, IP: , Connection Target: , Request: http://fccsteams/sites/DataManagement/Tasks/Lists/Tasks/Folders1.aspx?RootFolder=/sites/DataManagement/Tasks/Lists/Tasks/2013/11&, Form ID: urn:schemas-microsoft-com:office:infopath:list:-AutoGen-2013-08-05T23:14:53:458Z Type: DataAdapterException, Exception Message: The remote server returned an error: (500) Internal Server Error.  Operation Failure ---> Access Denied: To create a user profile, you must be an administrator, or create your own profile and have personal features rights.  UnauthorizedAccessAccess Denied: To create a user profile, you must be an administrator, or create your own profile and have personal features rights. The remote server returned an error: (500) Internal Server Error.)
    Notice how the username is now the entire email address and not just the username. I have no idea why it thinks that that is their username. Any ideas?

    Hi,
    According to your post, my understanding is that you got query failed error.
    Melick had written a blog said that the form access the user profile web service (Userprofileservice.asmx) using  UDC
    file.
    You can check whether the UDC connection was still pointing to root site.
    You can change this file to match with the sub site collection. Otherwise there may be a cross domain access issue.
    There are similar threads for your reference.
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/9c2f7f4c-0fa9-43bd-94b1-1d7075e35841/5566-error-with-getuserprofilebyname-and-infopah-browser-forms-using-claims-based-authentication
    http://social.msdn.microsoft.com/Forums/en-US/49753330-40c0-4327-9a9b-2c3304a74e67/sharepoint-infopath-and-populating-forms-with-ad-data?forum=sharepointcustomizationlegacy
    Thanks & Regards,
    Jason 
    Jason Guo
    TechNet Community Support

  • How to extract the Physical Query(database Query)

    Hi ,
    How to extract the Physical Query(database Query) from obiee which was fired in obiee
    Regards
    Ranga

    Hi Ranganath,
    Have a look the following links.
    Setting Logging level:
    http://gerardnico.com/wiki/dat/obiee/loglevel
    How to see physical query:
    http://gerardnico.com/wiki/dat/obiee/manage_session_log
    If you are new to OBIEE, spend some hours on the following blog to learn from basics to advanced level.
    http://gerardnico.com/wiki/
    http://obiee101.blogspot.com/
    http://www.rittmanmead.com/blog/
    Hope it helps you.
    Regards,
    Kalyan Chukkapalli
    http://123obi.com

  • Issue converting the following query to text.

    Hello guys, I'm trying to convert the following query to text and to use PRINT so that it returns theresult in the picture as output, help would be appreciated, thanks :)SELECT EventName, EventDate
    FROM EventTable
    ORDER BY EventDate DESC;

    This is an example, As I said it is not a good approach
    set nocount on
    declare @tab table(id int,txt varchar(100));
    declare @txt varchar(1000);
    declare @count int;
    insert into @tab
    values(1,'Text 1'),(2,'Text 2'),(4,'Text 4');
    select *,RN=ROW_NUMBER()OVER(ORDER BY (SELECT NULL)) into #temp from @tab
    select @count=@@ROWCOUNT;
    while @count>0
    begin
    select @txt =right(replicate(' ',50)+convert(varchar(50),ID),50) +
    right(replicate(' ',50)+convert(varchar(50),txt),50)
    from #temp where RN=@count
    set @count=@count-1
    print @txt
    end
    drop Table #temp
    Satheesh
    My Blog |
    How to ask questions in technical forum

  • How to transport the BW query's variable to BO  webi report

    Hi all
    I'd like to know how to transport the BW query's variable to BO 's webi . today ,I created a sap customer varible in my bw system to get the max calmonth in the active table.The varible in the BW side run's well ,but I use this query to build a new univers ,and created a new webi report base on this univers ,but the question is the webi report can't get the varible's value I wann to know how to transport the bw varible value to BO webi report
    Thanks and regards,
    Peter .zhu

    I have changed my variaable in my bw query ,I found if you use SAP default variable it is ok in BO side . So I get a guidline by SAP default variable ,I changed my customer variable in variables edite ,don't use 'ready for input' .And then the variable can be useful in BO side .
    Edited by: peter zhu on Jun 16, 2008 11:43 AM

  • Need help in the following query

    Hi ,
    I have the following query to pull out data for a particular timeperiod( campaign)
    select
    da.acct_nr,smas.mrkt_id,smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
    ,smas.stf_ind,da1.acct_nr,
    smas.fld_sls_cmpgn_perd_id,smas.acct_key,smas.upln_acct_key,smas.awrd_sls_amt,smas.fld_net_sls_amt
    ,smas.stf_ind,da1.acct_nr,prev.*
    From cdw.sum_mrkt_acct_sls smas
    join codi.dim_acct da
    on (smas.mrkt_id = da.mrkt_id and smas.acct_key = da.acct_key)
    join codi.dim_acct da1
    on (smas.mrkt_id = da1.mrkt_id and smas.UPLN_acct_key = da1.ACCT_KEY)
    where smas.acct_key in
    select dwnln_acct_key from codi.dim_ldrshp_genlgy
    where mrkt_id = 66 and fld_sls_cmpgn_perd_id = 20100304
    and root_upln_acct_key = (select acct_key from codi.dim_acct where acct_nr = '0032622' and mrkt_id = 66)
    and
    smas.mrkt_id = 66
    and smas.fld_sls_cmpgn_perd_id = 20100304
    and smas.sls_org_key <> -100
    order by 1
    So this query will pull out data for campaign 20100304
    No i want to modify the query to pull out data for 3 such campaigns.
    for a smas.acct_key
    so data will
    smas.acct_key all the data for 1st campaign , all the data for 2nd campaign. all the data for 3rd campaign
    Could you please help in modifying this query.
    Thanks

    How about this ??
    select da.acct_nr,
           smas.mrkt_id,
           smas.fld_sls_cmpgn_perd_id,
           smas.acct_key,
           smas.upln_acct_key,
           smas.awrd_sls_amt,
           smas.fld_net_sls_amt,
           smas.stf_ind,
           da1.acct_nr,
           smas.fld_sls_cmpgn_perd_id,
           smas.acct_key,
           smas.upln_acct_key,
           smas.awrd_sls_amt,
           smas.fld_net_sls_amt,
           smas.stf_ind,
           da1.acct_nr,
           prev.*
      From cdw.sum_mrkt_acct_sls smas
      join codi.dim_acct da on (smas.mrkt_id = da.mrkt_id and
                               smas.acct_key = da.acct_key)
      join codi.dim_acct da1 on (smas.mrkt_id = da1.mrkt_id and
                                smas.UPLN_acct_key = da1.ACCT_KEY)
    where smas.acct_key in (select dwnln_acct_key
                               from codi.dim_ldrshp_genlgy
                              where mrkt_id = 66
                                and fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
                                and root_upln_acct_key =
                                    (select acct_key
                                       from codi.dim_acct
                                      where acct_nr = '0032622'
                                        and mrkt_id = 66))
       and smas.mrkt_id = 66
       and smas.fld_sls_cmpgn_perd_id in( 20100304,20100305,20100306)
       and smas.sls_org_key - 100
    order by 1

  • How to analyzer the BI query in VISUAL COMPOSER?

    hi experts,
    could you please explain me how to analyze the Bex query in VISUAL COMPOSER? could you please provide me the step-by-step documentation if possible??
    regards
    vadlamudi

    Hi Vadlamudi,
    Here is some documentation for using BI Queries in VC:
    [Modeling Composite Views Using BI Data Services|http://help.sap.com/saphelp_nwce10/helpdata/en/46/081ed5f8685875e10000000a11466f/frameset.htm]
    [Maintaining BI System Connections|http://help.sap.com/saphelp_nwce10/helpdata/en/7e/6dbcea3700452195e3bddaa47c5906/frameset.htm]
    I hope it helps,
    Regards,
    Udi

  • Can I rewrite the following query without using Row_number() function ??!!

    Hello every one, can I rewrite the following query without using the 'ROW_NUMBER() OVER ' part.
    The query is supposed to pull out the records whose CODE is not NULL and has most
    recent date for UPDATE_DATE . The reason I wanted to do this is, When I embed this query
    in between many other queries along with JOINs, My oracle server is unable to execute. So, I thought
    its better to supplant 'ROW_NUMBER() OVER ' logic with something else and try it. .
    SELECT a.* FROM
    (SELECT b.*, ROW_NUMBER() OVER (PARTITION BY b.PIDM
    ORDER BY b.UPDATE_DATE DESC) AS Rno
    FROM
    SELECT *
    FROM SHYNCRO WHERE CODE IS NOT NULL
    )b
    )a
    WHERE a.Rno = 1

    Hi,
    You didn't write over 150 lines of code and then start testing it, did you?
    Don't.
    Take baby steps. Write as little as pssiblem test that. Debug and test again until you have something that does exactly what you want it to do.
    When you have somehting that works perfectly, take one baby step. Add a tiny amount of code, maybe 1 or 2 lines more, and test again.
    When you do get an error, or wrong results, you'll have a much better idea of where the problem is. also, you won't be building code on a flimsy foundation.
    If you need help, post the last working version and the new version with the error. Explain what you're trying to do in the new version.
    The error message indicates line 133. It looks like line 133 of your code is blank. Does your front end allow completely blank lines in the middle of a query? SQL*Plus doesn't by default; you have to say
    SET  SQLBLANKLINES  ONto have a completely blank line in SQL*Plus. (However, lines containing nothing but at commnet are always allowed.)
    You may have noticed that this site normally doesn't display multiple spaces in a row.
    Whenever you post formatted text (such as indented code) on this site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
    The 4 people who posted small code fragments for you to read all did this.  It would be so much easier for people to read your humongeous query if it were formatted.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Can u write the following query without using group by clause

    select sp.sid, p.pid, p.name from product p, supp_prod sp
    where sp.pid= p.pid and
    sp.sid = ( select sid from supp_prod group by sid
    having count(*) =(select count(*) from product));
    thru this, we retrieving all the products delivered by the supplier.
    Can you write the following query without using the group by clause

      select sp.sid, p.pid, p.name
        from product p, supp_prod sp
       where sp.pid= p.pid the above query will still retrieve all the products supplied by the supplier. sub-query is not necessary.
    maybe if you can post some sample data and output will help us understand what you want to achieve.

Maybe you are looking for

  • Itunes password problem

    I was having issues with itunes when it updated to 11.0.2 (not responding/ freezing and unable to force quit). After doing some internet research I waited and updated to 11.0.3 (all problems seemed to stop). However, though I was able to download som

  • SAP BI LOADING ISSUE

    i have a quary which is taking 2 hours daily but today its taking long time what could be the reagion.

  • Are apple trying to resolve battery life issue ?

    Hi, Since updating my iPhone 4 to iOS 5.1 my battery life has significantly decreased. Like myself several other users are having the same problem with terrible battery life. I am just wondering are apple trying to resolve this issue and if so by doi

  • HT1338 iphoto will not launch after Mountain Lion update

    I recently upgraded to OS X: Mountain Lion.  I can no longer launch iPhoto, I get this message; "You can't open your current photo library using this version of iPhoto. You have made changes to your photo library using a newer version of iPhoto. Plea

  • Radware for load balancing

              Hi           Not sure if this is the right place for putting this question.           Has anyone used radware with weblogic sucessfully?           We are running 2 weblogic servers ( temporarily) and plan to use           Radware to do the