Derived Table How can I give the results of this SQL Line an Explicit Name.

I am trying to create a derived table and I get the error
"each calculated column must have an explicit name"
I added the as shiptype to the end of the line and that did not work. Any thoughts?
shiptype = case when araddr.invno is not null then 'ADDR' else (case when arcadr.custno is not null then 'CADR' else 'CUST' end) end as shiptype,
Thanks
Jeff

Sure,
Here is the complete query.
This query works fine is sql query analyzer but when I put it in the designer I get the error.
SELECT      'C' as tableId,
'' as StartMast,
armast.invno as invno,
armast.invdte as invdte,
armast.ponum as ponum,
armast.ordate as ordate,
armast.shipvia as shipvia,
armast.fob as fob,
armast.ornum as ornum,
armast.disc as Idisc,
armast.taxrate as Itaxrate,
armast.tax as tax,
armast.invamt as invamt,
armast.disamt as disamt,
armast.paidamt as paidamt,
armast.balance as balance,
armast.dtepaid as dtepaid,
armast.pterms as pterms,
armast.arstat as arstat,
armast.artype as artype,
armast.notes as notes,
armast.salesmn as salesmn ,
'' as StartBill,
arcust.custno,
arcust.company as billComp,
arcust.contact as billaddr1,
arcust.address1 as billaddr2,
arcust.address2 as billaddr3,
arcust.city as billcity,
arcust.addrstate as billstate,
arcust.zip as billzip,
arcust.country as billcountry,
arcust.phone as billphone,
arcust.faxno as billfaxno,
rtrim(cast(arcust.email as varchar(2000))) as billemail,
'' as StartShip,
armast.tosw,
armast.cshipno,
shiptype = case when araddr.invno is not null then 'ADDR' else (case when arcadr.custno is not null then 'CADR' else 'CUST' end) end,
shipcomp = left(case when araddr.invno is not null then araddr.company else (case when arcadr.custno is not null then arcadr.company else arcust.company end) end + space(35),35),
shipaddr1 = left(case when araddr.invno is not null then araddr.address1 else (case when arcadr.custno is not null then arcadr.contact else arcust.contact end) end + space(30),30),
shipaddr2 = left(case when araddr.invno is not null then araddr.address2 else (case when arcadr.custno is not null then arcadr.address1 else arcust.address1 end) end + space(30),30),
shipaddr3 = left(case when araddr.invno is not null then araddr.address3 else (case when arcadr.custno is not null then arcadr.address2 else arcust.address2 end) end + space(30),30),
shipcity = left(case when araddr.invno is not null then araddr.city else (case when arcadr.custno is not null then arcadr.city else arcust.city end) end + space(20),20),
shipstate = left(case when araddr.invno is not null then araddr.addrstate else (case when arcadr.custno is not null then arcadr.addrstate else arcust.addrstate end) end + space(10),10),
shipzip = left(case when araddr.invno is not null then araddr.zip else (case when arcadr.custno is not null then arcadr.zip else arcust.zip end) end + space(10),10),
shipcntry = left(case when araddr.invno is not null then araddr.country else (case when arcadr.custno is not null then arcadr.country else arcust.country end) end + space(15),15),
'' as StartCmnt,
armast.commid as commid,
arcomm.comment as CommCmnt,
arscom.comment as ScomCmnt,
invCmnt = isnull(
            case
                  when armast.commid = 'MISC' then arcomm.comment
                  when len(rtrim(armast.commid)) > 0 then arscom.comment
                  else ''
            end
'' as StartTran,
artran.tranlineno,
artran.item,
artran.loctid,
artran.Descrip,
artran.intmemo,
artran.custmemo,
artran.qtyord,
artran.qtyshp,
artran.price,
artran.disc as ldisc,
artran.taxrate as ltaxrate,
artran.extprice,
artran.taxable,
artran.arstat as linestat,
artran.artype as linetype
FROM armast
LEFT JOIN artran ON artran.invno = armast.invno
Left JOIN arcust ON arcust.custno = armast.custno
Left JOIN arcomm ON arcomm.invno = armast.invno
Left JOIN arscom ON arscom.commid = armast.commid
LEFT JOIN araddr ON araddr.invno = armast.invno
LEFT JOIN arcadr ON arcadr.custno = armast.custno AND arcadr.cshipno = armast.cshipno
WHERE (armast.invdte >= getdate() - 180 OR len(rtrim(armast.arstat)) = 0)
      AND armast.invno <> '_RECEIPT'
      AND len(rtrim(armast.currhist)) = 0
      AND armast.custno = 'TJS-01'
Union All
SELECT      'H' as tableId,
'' as StartMast,
arymst.invno as invno,
arymst.invdte as invdte,
arymst.ponum as ponum,
arymst.ordate as ordate,
arymst.shipvia as shipvia,
arymst.fob as fob,
arymst.ornum as ornum,
arymst.disc as Idisc,
arymst.taxrate as Itaxrate,
arymst.tax as tax,
arymst.invamt as invamt,
arymst.disamt as disamt,
arymst.paidamt as paidamt,
arymst.balance as balance,
arymst.dtepaid as dtepaid,
arymst.pterms as pterms,
arymst.arstat as arstat,
arymst.artype as artype,
arymst.notes as notes,
arymst.salesmn as salesmn ,
'' as StartBill,
arcust.custno,
arcust.company as billComp,
arcust.contact as billaddr1,
arcust.address1 as billaddr2,
arcust.address2 as billaddr3,
arcust.city as billcity,
arcust.addrstate as billstate,
arcust.zip as billzip,
arcust.country as billcountry,
arcust.phone as billphone,
arcust.faxno as billfaxno,
rtrim(cast(arcust.email as varchar(2000))) as billemail,
'' as StartShip,
arymst.tosw,
arymst.cshipno,
shiptype = case when aryadr.invno is not null then 'YADR' else (case when arcadr.custno is not null then 'CADR' else 'CUST' end) end,
shipcomp = left(case when aryadr.invno is not null then aryadr.company else (case when arcadr.custno is not null then arcadr.company else arcust.company end) end + space(35),35),
shipaddr1 = left(case when aryadr.invno is not null then aryadr.address1 else (case when arcadr.custno is not null then arcadr.contact else arcust.contact end) end + space(30),30),
shipaddr2 = left(case when aryadr.invno is not null then aryadr.address2 else (case when arcadr.custno is not null then arcadr.address1 else arcust.address1 end) end + space(30),30),
shipaddr3 = left(case when aryadr.invno is not null then aryadr.address3 else (case when arcadr.custno is not null then arcadr.address2 else arcust.address2 end) end + space(30),30),
shipcity = left(case when aryadr.invno is not null then aryadr.city else (case when arcadr.custno is not null then arcadr.city else arcust.city end) end + space(20),20),
shipstate = left(case when aryadr.invno is not null then aryadr.addrstate else (case when arcadr.custno is not null then arcadr.addrstate else arcust.addrstate end) end + space(10),10),
shipzip = left(case when aryadr.invno is not null then aryadr.zip else (case when arcadr.custno is not null then arcadr.zip else arcust.zip end) end + space(10),10),
shipcntry = left(case when aryadr.invno is not null then aryadr.country else (case when arcadr.custno is not null then arcadr.country else arcust.country end) end + space(15),15),
'' as StartCmnt,
arymst.commid as commid,
arcomm.comment as CommCmnt,
arscom.comment as ScomCmnt,
invCmnt = isnull(
            case
                  when arymst.commid = 'MISC' then arcomm.comment
                  when len(rtrim(arymst.commid)) > 0 then arscom.comment
                  else ''
            end
'' as StartTran,
arytrn.tranlineno,
arytrn.item,
arytrn.loctid,
arytrn.Descrip,
arytrn.intmemo,
arytrn.custmemo,
arytrn.qtyord,
arytrn.qtyshp,
arytrn.price,
arytrn.disc as ldisc,
arytrn.taxrate as ltaxrate,
arytrn.extprice,
arytrn.taxable,
arytrn.arstat as linestat,
arytrn.artype as linetype
FROM arymst
LEFT JOIN arytrn ON arytrn.invno = arymst.invno
Left JOIN arcust ON arcust.custno = arymst.custno
Left JOIN arcomm ON arcomm.invno = arymst.invno
Left JOIN arscom ON arscom.commid = arymst.commid
LEFT JOIN aryadr ON aryadr.invno = arymst.invno
LEFT JOIN arcadr ON arcadr.custno = arymst.custno AND arcadr.cshipno = arymst.cshipno
WHERE (arymst.invdte >= getdate() - 180 OR (len(rtrim(arymst.arstat)) = 0 AND arymst.invno in (select invno FROM armast where len(rtrim(arstat)) = 0)))
      AND arymst.invno <> '_RECEIPT'
      AND arymst.custno = 'TJS-01'

Similar Messages

  • How can i export the results for this loop

    Hi all 
    i wrote a script to do nslookup for a list of web sites here is the code i wrote 
    $servers = get-content "C:\NSLOOKUP.txt"
    foreach ($server in $servers) {
    $addresses = [System.Net.Dns]::GetHostAddresses($server)
    foreach($a in $addresses) {
    "{0},{1}" -f $server, $a.IPAddressToString
    } | Export-Csv 'C:\scripts\output.csv' -NoType
    but it didn't export shall you support me on this 

    Hi,
    Try it this way:
    Get-Content .\wwwList.txt | ForEach {
    $addr = [System.Net.Dns]::GetHostAddresses($_)
    $props = @{
    Name = $_
    Addresses = $addr.IPAddressToString -join ','
    New-Object PsObject -Property $props
    } | Sort Name | Export-Csv .\wwwList.csv -NoTypeInformation
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How can i display the result of java class in InputText ?

    Hi all,
    How can i get the result of java class to InputText Or OutputText ???
    also can every one in the forum give me road map for dealing with java in oracle adf because i'm beginner in oracle adf
    i saw some samples in oracle adf corner but it's difficult for me.

    User,
    Always mention your JDev version, technologies used and clear usecase description (read through this announcement : https://forums.oracle.com/forums/ann.jspa?annID=56)
    How can i get the result of java class to InputText Or OutputText ???Can you elaborate on your requirement? Do you mean the return value of a method in a class as output text? Or an attribute in your class (bean?) as text field?
    -Arun

  • How can I export the results of a query?

    After executing a select statement I can see the results in a grid but how can I export the results (the data)?
    How can I export the results of a join of two or more tables?

    Right click in the results grid and select the Export menu option

  • How can we give the Data Format (File Type ) in Runtime

    Hi all,
    How can we give the Data Format (File Type ) in Runtime for the following method,
    cl_gui_frontend_services=>gui_download.
    Thanks in advance
    Sri

    There is a filetype parameter which you can set
    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
    *    BIN_FILESIZE              =
        filename                  =
    *    FILETYPE                  = 'ASC'
    *    APPEND                    = SPACE
    *    WRITE_FIELD_SEPARATOR     = SPACE
    *    HEADER                    = '00'
    *    TRUNC_TRAILING_BLANKS     = SPACE
    *    WRITE_LF                  = 'X'
    *    COL_SELECT                = SPACE
    *    COL_SELECT_MASK           = SPACE
    *    DAT_MODE                  = SPACE
    *    CONFIRM_OVERWRITE         = SPACE
    *    NO_AUTH_CHECK             = SPACE
    *    CODEPAGE                  = SPACE
    *    IGNORE_CERR               = ABAP_TRUE
    *    REPLACEMENT               = '#'
    *    WRITE_BOM                 = SPACE
    *    TRUNC_TRAILING_BLANKS_EOL = 'X'
    *  IMPORTING
    *    FILELENGTH                =
      changing
        data_tab                  =
    *  EXCEPTIONS
    *    FILE_WRITE_ERROR          = 1
    *    NO_BATCH                  = 2
    *    GUI_REFUSE_FILETRANSFER   = 3
    *    INVALID_TYPE              = 4
    *    NO_AUTHORITY              = 5
    *    UNKNOWN_ERROR             = 6
    *    HEADER_NOT_ALLOWED        = 7
    *    SEPARATOR_NOT_ALLOWED     = 8
    *    FILESIZE_NOT_ALLOWED      = 9
    *    HEADER_TOO_LONG           = 10
    *    DP_ERROR_CREATE           = 11
    *    DP_ERROR_SEND             = 12
    *    DP_ERROR_WRITE            = 13
    *    UNKNOWN_DP_ERROR          = 14
    *    ACCESS_DENIED             = 15
    *    DP_OUT_OF_MEMORY          = 16
    *    DISK_FULL                 = 17
    *    DP_TIMEOUT                = 18
    *    FILE_NOT_FOUND            = 19
    *    DATAPROVIDER_EXCEPTION    = 20
    *    CONTROL_FLUSH_ERROR       = 21
    *    NOT_SUPPORTED_BY_GUI      = 22
    *    ERROR_NO_GUI              = 23
    *    others                    = 24

  • Please tell me the soluation How can I give the soluation bilow issue.

    Dear Experts,
    Please tell me the soluation How can I give the soluation bilow issue.
    Currently user are facing one problem with respect of Line item report.
    In any of the line item report (i.e. FBL1N, FBL3N, FBL5N) we want to view header reference as column data wonu2019t appear in any of the reference filed.
    For Example in Bank G/L Cheque number was enter in reference field but same is not apear
    In Sales G/L or tax G/L invoice number is to be appear which is again invoice number as reference in document.
    Regards
    Devendra.
    Moderator: Give proper titles to your threads

    Hi,
    To add Reference field in line item report do below.
    From FBL1N output screen.
    Click change layout / (clr + F8)
    Now add Hidden field u2018Referenceu201D to column content and push copy button.
    Now you should be able to view reference field (BKPF- XBLNR) in line item report.
    Best Regards,
    Raju

  • How can I improve the performace of this?

    I have two tables - TableA and TableB. TableB is having 500,000,000 rows. I need to insert these rows, after some processing on them, into tableA. My insert statement is like this -
    Insert into tableA
    select A,B,C,...
    from TableB
    How can I improve the performace of this?
    Here it will select 500,000,000 rows from TableB and store the result in cache and then start inserting.
    Do I have any way so that the select statement starts releasing the records (and not wait upto 500,000,000 record ) and in parallel insert statement start inserting the records?

    Shirish,
    You need to insert more than 500 millions of rows in a table, right ?
    But one point can be a problem, this is when you said "I need to insert these rows, after some processing on them". What does that means after some processing ?
    Please give us more information about all your process, maybe the problem doesn't come from the insert itself ?
    And why the APPEND hint cannot be an answer ?
    And why create table cannot be an answer ?
    What time did you expected for insert of these 500 millions of rows ?
    Nicolas.

  • How can we know the source code no.of lines

    hi guys!
    please help me, how can we check the source code(No. of lines)in program with out comments

    hi,
    Use this code. Replace with your program name with the text in bold. V_lines gives the no of lines of code excluding comments and as well blank lines.
    TYPES: BEGIN OF t_type,
             line(72),
           END OF t_type.
    DATA: program LIKE sy-repid
                     VALUE <b>'Z_ABC_INNER_JOIN'</b>,
          t TYPE STANDARD TABLE OF t_type WITH HEADER LINE.
    DATA: v_lines TYPE i.
    READ REPORT program INTO t.
    IF sy-subrc =0.
      LOOP AT t.
        IF t+0(1) = '*' OR t IS INITIAL.
          DELETE t INDEX sy-tabix.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t LINES v_lines.
    ENDIF.
    WRITE : v_lines.
    Regards,
    Sailaja.

  • I have a Mac Pro OS 10.7.5 and have a DVD+R disc with files on it, but it ejects the disk after about 10 seconds--what to do?  How can I get the data off this disc?  I can see it has been already burned, so files are on there?

    I have a Mac Pro OS 10.7.5 and have a DVD+R disc with files on it, but it ejects the disk after about 10 seconds--what to do?  How can I get the data off this disc?  I can see it has been already burned, so files are on there?

    Try cleaning the lens and see if that will restore functionality to the DVD drive.  Use a DVD lens cleaning disk, if you have a can of compressed air, shoot some into the slot or wrap a fine microfiber cloth (eyeglasses cleaning cloth)  around a business card and insert it gently inside the slot.
    If no success, make an appointment at an Apple store genius bar and get a free diagnosis from them.
    Ciao.

  • I HAVE TO INSTAL A PRODUCT C LLED "KUDANI AIR " . FAILURE TO DO SO IS BASED ON  ADOBE AIR , SO I AM TOLD . HOW CAN I MAKE SURE THAT IS THE CASE ?? HOW CAN I SOLVE THE PROBLEM IF THIS IS THE CASE ??

    I HAVE TO INSTALL A PRODUCT CALLED "KUDANI AIR " . FAILURE TO DO SO IS BASED ON  ADOBE AIR , SO I AM TOLD . HOW CAN I MAKE SURE THAT IS THE CASE ?? HOW CAN I SOLVE THE PROBLEM IF THIS IS THE CASE ??

    if you try to install an app that depends on adobe air, you should be prompted to download and install adobe air (unless it's already installed).
    you can download and install directly so you're not prompted by that app, Adobe - Adobe AIR

  • How Can I change the Authentication for this Dynpage

    Hello ,
    I have created a rss feed in special Dnypage.   When I try to connect with rss reader  to dynpage it occurs an error 500.  The problem is that no logon screen appears and the portal would start the Dynpage with the User Guest.
    How Can I change the Authentication for this Dynpage ? I need a LogonScreen
    RSS URL:
    /irj/servlet/prt/portal/prtmode/rss/prtroot/com.geberit.ep.uwlquick.uwlquickstarter?mode=rss

    Hi ,
    sry the entry in xml does not help. No Logon Prompt
    <?xml version="1.0" encoding="UTF-8"?>
    <application>
      <application-config>
        <property name="SecurityArea" value="NetWeaver.Portal"/>
        <property name="Vendor" value="xx.com"/>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb,com.sap.portal.pcd.glservice,com.sap.portal.ivs.iviewservice,usermanagement,,com.sap.netweaver.bc.uwl"/>
      </application-config>
      <components>
        <component name="uwlquickstarter">
          <component-config>
              <property name="SafetyLevel" value="no_safety"/>
            <property name="ClassName" value="com.xx.portal.uwl.uwlquickstarter"/>   
          </component-config>
              <component-profile>
                   <property name="AuthScheme" value="default"/>
              </component-profile>
        </component>
      </components>
      <services/>
    </application>

  • TS3694 how can i resolve the issue of this error 1015?

    how can i resolve the issue of this error 1015?

    Google it. You can not get help for your jailbroken phone here.

  • I have Point, how can I get the component of this Point?

    Hi, everybody!
    Can U help me!
    I have 10 block in 1 applet. After 1 even, I kept the Point of the block, just made even. I want remove the block, which have the point. Then I use method getComponentAt() but I can't.
    Anyone tell me the way to process.
    Agains, I have the Point, how can I get the component of this Point?
    Thanks so much!

    That makes no difference, as you can still use this method with AWT.
    // parent is you main Frame or Dialog window.
    Component parent;
    // target is the AWT component that the user has clicked on.
    Component target;
    // "e" is is your click event.
    MouseEvent e;
    target = SwingUtilities.getDeepestComponentAt(parent, e.getX(), e.getY());

  • How can I get the return code of SQL*Plus under Win2000Pro

    How can I get the return code of SQL*Plus under Win2000Pro ?

    In a DOS batch script? Try ECHO %ERRORLEVEL%
    -- CJ

  • HT2534 What is iTune gift card? How can i get the code from this?

    What's iTune gift card? How can i get the code from this?

    "What's iTune gift card?"
    It is a gift card like any other gift card.  It is a card that contains credit for purchases in the itunes store.
    "How can i get the code from this?"
    Genreally there is a scratch of area under which the code lies.

Maybe you are looking for

  • Using multiple physical tables in a single logical dimension table

    I have two physical tables that are related on a 1 to 1 basis based on a natural key. One of these tables is already part of my RPD file (actually, it is the W_EMPLOYEE_D from the Oracle BI Applications). The second table contains additional employee

  • Mutual Changes of sales document in  CRM and ECC

    HI 1.We have a scenario as we are creating orders in CRM, but want to change the same in ECC. Also whatever changes we do in ECC should flow back to CRM. 2.Similarly, if we create sales order in ECC, it should be changeable in CRM and the corresponsi

  • Ableton Live 8 to Logic Pro 9 Switch?!?

    Hey everyone, I'm a producer and own a record label and I recently bought a Mac Mini (Mid-2007) that I have succesfully upgraded to Mac OS X Snow Leopard! I am very familar with the Mac interface so that is not an issue, but I am not familar with the

  • Photoshop CS5 (Mac) is crashing when I ask it to print a pdf.

    Photoshop crashes when I ask it to print a pdf.  Before I upgraded to a larger system hard drive, this issue did not exist.  Before the upgrade, I coud scan an item with Acrobat X Pro (Mac), but it would not print correctly.  I found that if I opened

  • Instantiating a Class

    I need to Instantiate a Class from a String. For example, i have the String "MyClass", i need to Instantiate the class MyClass. Is it possible ? Help, me. Thanks.