Report Builder 6i not recognizing analytic functions

Hi all, in an attempt to speed up a very slow query, I applied analytic function to it. I can save the query in report builder with no problems, however, I cannot create data links between this query and others. After I comment out the analytic function, data links can be made. My colleague said Report Builder 6i is too old so it can only recognize ANSI SQL syntax. Since our DB server is using Oracle 10gR2, is there a way for Report Builder to recognize and compile Oracle 10g syntax?
Many thanks.

Hello,
Your colleague is right. Even if the SQL query is executed by the DB server , Reports needs to parse the SQL query.
The SQL parser included in Reports 6i is based on 8.0.6
You can see this version in the Reports Builder help :
Menu : Help -> About Reports Builder ...
ORACLE Server Release 8.0.6.0.0
Regards

Similar Messages

  • Report Builder: can i define a function in  the rdf file ?

    Hi All,
    About the report builder, can i define a function in the rdf file ? and then i want invoke it in the report SQL, just like :
    function Get_Ap_Prepay_Balance(p_Invoice_Id IN NUMBER, p_End_Date IN DATE) RETURN NUMBER IS
    l_Amount number;
    begin
    RETURN l_Amount;
    end;
    thanks.

    You can create functions in reports, but slightly different from doing it in PL/SQL
    function Get_Ap_Prepay_Balance return number is
    l_Amount number;
    begin
    assuming that you have invoice_id in your select statement and p_End_Date is a report parameter, you can refer to them in your function as :p_End_Date and :invoice_id
    for example select prepay_amount_remaining into l_Amount from ap_invoice_distributions where invoice_id = :invoice_id and accounting_date = :p_End_Date
    return(l_Amount);
    hope this helps

  • Report Builder is not exist in fusion middleware forms&reports installation

    Dear All,
    i have installed oracle fusion middleware forms & report services ofm_frmrpts_win_11.1.2.1.0_64_disk1_1of1.
    form builder is there, but the report builder is not there? why? where is report builder?
    Regards.

    Hi Maahjoor,
    Try Starting Report Builder using the rwbuilder.bat found in the %ORACLE_INSTANCE%\config\reports\bin\ directory.
    If you still getting issues
    a)Backup the %ORACLE_INSTANCE%\config\reports\bin\ rwbuilder.bat file
    b)Now modify rwbuilder.bat file from the %ORACLE_HOME%\bin\rwbuilder.bat file,by manually hard-coding the correct paths for:
    $$Instance.directory$$\config\reports\bin\reports.bat
    $$Instance.oracle_home$$\bin\rwbuilder.exeThat is, if your instance home is C:\Oracle\Middleware\as_inst1, then change the rwbuilder.bat to reflect:
    C:\Oracle\Middleware\as_inst1\config\reports\bin\reports.bat
    C:\Oracle\Middleware\as_inst1\bin\rwbuilder.exe
    c)Then, re-execute the modified rwbuilder.bat file from the %ORACLE_INSTANCE%\config\reports\bin\ .
    If it still doesnt work...
    Follow these 2 metalink ID's ,They will be helpful
    *REP-50125 "rwbuilder.conf:java.lang.NullPointerException" Trying To Open Reports Builder[Article ID 1532120.1]*
    *Report Builder 11g on MS Windows Errors with: REP-50125[Article ID 1059638.1]*
    Regards
    Fabian

  • JSP graph image works in Reports Builder but not in JDev9i

    Robin,
    None of these changes work. What else should I check?
    In the rwservlet.properties file (not rwserver.properties **)
    I changed #IMAGEURL=http://<web_server_name>:<port_num>/reports/rwservlet
    to IMAGEURL=C:\Oracle\Oracle9iDS2\reports\cache\
    or
    IMAGEURL=http://<web_server_name>:<port_num>/servlet/oracle.reports.rwclient
    .RWClient
    [IMAGEURL=http://163.249.38.151:8988/servlet/oracle.reports.rwclient.RWClient]
    [IMAGEURL=http://163.249.38.151:8888/servlet/oracle.reports.rwclient.RWClient]
    Would my localhost name and http port be the in-process JDeveloper OC4J listener?
    Also my ports keep being reassigned (up one number) when I terminate the embedded OC4J server and run the JSP again. (That is what you meant by restart the server, right?) from 8988 to 8989 to 8990 etc.
    John Williams
    Hi John,
    The reason that you aren't seeing that graph in JDeveloper is that rwservlet
    isn't available with the JDeveloper in-process OC4J listener. The OC4J
    listener is the minimum requirement. In addition, Reports forces the graph
    to be retrieved via the Reports server for security reasons. Ie: you
    shouldn't be able to get at graph images simply by knowing their URL. In
    the Reports builder environment, security is not the issue so there is a
    direct reference to the file.
    Now, when you're running from JDeveloper, you need to tell Reports how it
    should configure the URL. Reports runs in a secure mode by default to
    retrieve the images and, since JDeveloper is calling it as a through a Web
    listener, it is responding to a normal request and hence forcing the image
    to be retrieved via rwservlet.
    To tell Reports to access images directly or through another listener, you
    need to alter the %ORACLE_HOME%\reports\conf\rwserver.properties file and
    uncomment and change the following line: **
    #IMAGEURL=http://<web_server_name>:<port_num>/reports/rwservlet
    to
    IMAGEURL=C:\Oracle\Oracle9iDS2\reports\cache\
    Or
    IMAGEURL=http://<web_server_name>:<port_num>/servlet/oracle.reports.rwclient
    .RWClient
    Where <web_server_name> and <port_num> are the values of the in-process
    JDeveloper OC4J listener.
    You will need to re-start the Reports server. This should generate the
    appropriate link to the image when run from JDeveloper.
    When you deploy your application through a standard iAS OC4J instance
    containing the Reports Servlet, this IMAGEURL entry should again be
    commented out. Since the servlet is available in this iAS OC4J instance,
    the images will appear when referenced through rwservlet.
    Robin.
    When I leave the server parameter attribute out my GraphReport.jsp runs
    from JDev9i (using the same server as Reports Builder). The only thing
    missing now is the graph after my report. It shows up as a small square
    image tag.

    I found out the answer to both of my problems.
    1) for the missing graph image
         In the documentation link below I found a pdf file that gave the details.
    In the rwservlet.properties file in the IMAGEURL attribute
    the part that was missing is after the port #.
    IMAGEURL=http://<host>:<port>/<Workspace>-<Project>-context-root
    /servlet/oracle.reports.rwclient.RWClient
    2) for the port conflict - switch from the 'ojvm' virtual machine to 'hotspot'
         so that the embedded OC4J server is killed when it is terminated.
    I found these answers under Oracle Technology Network > documentation
    at http://otn.oracle.com/docs/products/reports/content.html
    Development Tools
    Reports Developer
    Oracle9i Reports Release Notes (pdf file)
    1.19 Oracle JDeveloper Integration
    1.19.2 Graph Not Appearing in Oracle JDeveloper
    When running a JSP report with the rw:graph tag in Oracle JDeveloper, the image is not visible in the browser. To fix this problem, set the IMAGEURL in the rwservlet.properties file in ORACLE_HOME/reports/conf:
    IMAGEURL=http://<host>:<port>/<Workspace>-<Project>-context-root
    /servlet/oracle.reports.rwclient.RWClient
    1.19.3 Reports In-process Server
    If the Java Virtula Machine (JVM) is set to ojvm, minimal, or vanilla in Oracle JDevelopers Virtual Machine settings (Project Settings -> Runner -> Virtual Machine), the rwservlet's in-process server is not killed when JDevelopers embedded OC4J server is terminated. As a result, a port conflict occurs the next time that OC4J is started.
    To avoid this problem, do one of the following:
    Set the JVM to Java Virtual Machine to hotspot.
    Disable the in-process server in ORACLE_HOME/reports/conf/rwservlet.properties and
    use the standalone Reports Server instead.
    John Williams

  • Help:  Report Builder does not do JSP on Laptop ......

    Hi, your experts:
    I installed 9i DB and 9i DS (a complete 1.9GB install) in separate homes on a laptop running win 2000. I can create or open paper-layout reports with no problem. But, I can NOT create new JSP reports (using report wizard) OR open JSP reports created elsewhere. An "internal error (REP-0069, see below) occurs when the "Finish" button is clicked in the final step of the wizard or open button is clicked in file opener. The error occurs no matter whether my laptop is connected to our LAN or not. I did a complete deinstall and then a complete (re)install and the problem is still there.
    Following is a detailed description of what happens when you try to create a jsp report using the report wizard:
    When the finish button is clicked, a Report Builder error message box pops up with the following messages:
    REP-0069: Internal error
    REP-0: IDL:oracle/reports/RWException:1.0
    After OK button of the msg box is clicked, the following error pops up:
    REp-6023: Unable to parse template file: rwbeige.html
    Click on the OK button, the REP-0069 box pops up again. Clicl on the Ok button now, the web source editor will show up with codes in it.
    Now, if you try to run the report, the following error popsup:
    REP-0069 Internal error
    REP-50003: Bad command line: webserver_srcroot=C:\ORA9IDS\reports\docroot
    RVER_DOCROOT=c:/documents and settings/duz/localsettings/temp/docroot
    Click on OK, you get the browser with "The page cannot be displayed" error messages.
    Any suggestions and comments are appreciated. Thank you in advance.
    Zhirong
    P.S., By the way, my 9i DS is paid production version, and I tried to get help from Oracle Support. However, because they can not reproduce the problem, they can not do anything about it.

    hello,
    look in your O_H/reports/templates for a file rwbeige.html. it might be that it is missing. if so, just copy one of the others (rwgreen.html, rwblue.html, ...) to the rwbeige.html name or choose another template in the wizard.
    regards,
    philipp

  • Forms 10g not supporting Analytical functions

    Hi all
    i try to use analytic funtion like
         row_number() over (partition by uuid order by timesheet_acct) rn
    but form did not compile this while when i run the same analytic function in SQL prompt it runs fine. is forms support Analytical functions?? if not then what can i do for performing this task at form??
    thx.

    Ok, so look at this stored function:
    CREATE OR REPLACE FUNCTION Return_Cursor
      PC$Select IN VARCHAR2
    ) RETURN SYS_REFCURSOR
    IS
      cc  SYS_REFCURSOR ;
    BEGIN
      OPEN cc FOR PC$Select ;
      RETURN cc ;
    END ;
    /Then imagine you can call it with ANY query like the following:
    SQL> set serveroutput on
    SQL> DECLARE
      2     cur SYS_REFCURSOR ;
      3     CURSOR c IS SELECT deptno, ename, sal FROM EMP ;
      4     rec c%ROWTYPE ;
      5     LC$Req  VARCHAR2(2000) ;  
      6    BEGIN
      7      LC$Req := 'SELECT deptno, ename, sal FROM ' ;
      8      LC$Req := LC$Req || '(SELECT deptno, ename, sal, row_number() over ' ;
      9      LC$Req := LC$Req || '(PARTITION BY deptno ORDER BY sal DESC) FROM EMP ORDER BY deptno, sal)' ;
    10      cur := Return_Cursor( LC$Req ) ;
    11      LOOP
    12        FETCH cur INTO rec ;
    13        EXIT WHEN cur%NOTFOUND ;
    14        dbms_output.put_line( rec.DEPTNO || '  ' || rec.ENAME || ' -> ' || rec.SAL ) ;
    15      END LOOP ;
    16      CLOSE cur ;
    17  END;
    18  /
    10  MILLER -> 1301
    10  CLARK -> 2450
    10  KING -> 5000
    20  SMITH -> 915
    20  ADAMS -> 1100
    20  JONES -> 2975
    20  SCOTT -> 3000
    20  FORD -> 3000
    30  JAMES -> 950
    30  WARD -> 1250
    30  MARTIN -> 1250
    30  TURNER -> 1500
    30  ALLEN -> 1600
    30  BLAKE -> 2850
    Procédure PL/SQL terminée avec succès.What do you think ?
    Francois

  • Output shows in report builder but not in concurrent program

    Dear All
    I have made a concurrent program and attach to responsibilty. but when it is submitted it does not fetch any data , it fetches the data when it is run in report builder.
    Kindly update it
    regards
    Arifuddin

    yeah it is a custom report and has attach to responsibilty.
    product version 11.5.10.2
    Platform: Linux x86
    database 10.2.0.2
    I thin this is the Error :CUSTOM APPLICATIONS: Version : UNKNOWN
    xxxx CUSTOM APPLICATIONS: Version : UNKNOWN
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    XX_OH_ITC module: XXXX On Hand ITC (CSS)
    Current system time is 07-FEB-2011 21:51:13
    +-----------------------------
    | Starting concurrent program execution...
    +-----------------------------
    Arguments
    P_START_DATE='2010/10/05 00:00:00'
    P_END_DATE='2010/12/05 00:00:00'
    Current NLS_LANG and NLS_NUMERIC_CHARACTERS Environment Variables are :
    American_America.AR8ISO8859P6
    Report Builder: Release 6.0.8.28.0 - Production on Mon Feb 7 21:51:13 2011
    (c) Copyright 1999 Oracle Corporation. All rights reserved.
    Enter Username:
    Start of log messages from FND_FILE
    End of log messages from FND_FILE
    Executing request completion options...
    ------------- 1) PRINT   -------------
    Printing output file.
    Request ID : 30945619      
    Number of copies : 0      
    Printer : noprint
    Finished executing request completion options.
    Concurrent request completed successfully
    Current system time is 07-FEB-2011 21:51:14
    Regards
    Arifuddin

  • Reports Builder does not react

    Hello,
    I've a strange problem. If I want to start my reports Builder (Oracle developer suite->Reports Developer->Reports Builder) I get the normal startup screen (GUI), I see the Oracle Reports Builder -> Oracle developer 10g suite screen but nothing seems to happen after that. So developer does not startup. If I look at my taskmanager I see the task RWBUILDER.exe but no cpu acivities. I'm using Oracle 10g, I've already reinstalled the developer suite again, but it makes no difference.
    Any one has an idea what this can bee?
    kind regards,
    Richard van der Haag

    Hello,
    In order to know if the problem is related to the Reports Builder window location, you can use the free utility winlister :
    http://www.nirsoft.net/utils/winlister.html
    Is there an "entry" for Reports Builder ?
    If yes, what is the value for Location ?
    Regards

  • Surprised that 1Z0-047 (SQL Expert) does not include Analytic Functions

    Apparently, from a reading of the 1Z0-047 outline,  Analytic Functions are not "in scope" for the Exam.
    Comments, anyone ?
    Hemant K Chitale

    Comments, anyone ?
    There are definitely some gaps in the SQL coverage on that exam. I could see the exam being redone (and improved) for 12C much as 1Z0-144 was rewritten for 11G as a much improved version of 1Z0-147.  I'd like to see them remove the individual listing of topics pulled from SQL Fundamentals.  They should be replaced with either a much-compressed list or a single note that knowledge of SQL fundamentals is assumed.  This might help with the level of confusion newbies have over which test they should take.
    Adding all of the functions you mention would not only make the test more comprehensive but also allow the tone of the exam to be altered.  Right now I consider it to be filled with questions intended to misdirect the test candidate.  The questions are 'tricky' rather than 'difficult'. This is largely because SQL is inherently easy to read so the only way to make it hard *is* to write deliberately bad SQL. Adding more advanced topics would allow for more questions that don't have to be made artificially more difficult.

  • Reports Builder does not start

    Hi,
    My Report Builder (v. 9.0.4.0.27) does not start. If I start it I get the initial pop up with the "Oracle Reports Developer - Oracle Developer Suite 10g" and the rwbuilder process is running. I dont get the application window. If I end rwbuilder process the popup is gone.
    I run Windows XP Pro sp 3. (Forms Builder works fine.)
    Any clues?
    Lodewijk

    There is a strange "feature": sometimes when you open up report-builder it will place the report-builder-window somewhere outside the screen. What works for me: Right click the report-builder-entry in the taskbar and choose maximize, this should make the window visible again.
    hope this helps.

  • Flash Builder Burrito not recognizing E4X syntax

    Hi,
    I have a function in a data proxy that assigns XML from a web API to a value object.
    private function handleDevNewsDataGetComplete(e:Event):void 
              vo.devNewsDataXML = new XML( e.target.data );
              vo.devNewsHeadline = vo.devNewsDataXML..*::Title[0].text();
              vo.devNewsArticle = vo.devNewsDataXML..*::Summary[0].text();
              vo.devNewsSource = vo.devNewsDataXML..*::NewsSource[0].text();
    I had no problems with Flash Builder, but since upgrading to Flash Builder Burrito, I have been getting errors (see below). Please help!
    Description    Resource    Path    Location    Type
    Title cannot be resolved to a type    DeveloperDataProxy.as    Flex Problem
    Description    Resource    Path    Location    Type
    The variable Summary is undefined    DeveloperDataProxy.as    Flex Problem
    Description    Resource    Path    Location    Type
    The variable NewsSource is undefined    DeveloperDataProxy.as    Flex Problem

    Hi,
    Are you using Flash Builder Burrito preview release build?
    Do you reproduce this consistently?
    The same code compiles fine for us.
    Can you please attach your eclipse log file?
    Thanks,
    Balaji

  • Graphics in report builder 6i not working in a 64 bit enviroment

    Is there a patch or a workout for this scenario? Can i use graphics from excel and use an OLE2 object item in the report? How would i send the parameters (info) for the graphic?
    thanks

    Anyone can help me ? Thanks

  • Error using Analytic function in reports

    Hi,
    I am trying to use Oracle analytic function (lag) in a report. But am getting the below error:
    Encountered the symbol "(" when expecting one of the following:
    ,from into bulk
    This is the code in the formula column:
    function extend_lifeFormula return VARCHAR2 is
    l_extend_life VARCHAR2(80);
    l_life_in_months VARCHAR2(80);
    l_asset_id NUMBER;
    begin
    SRW.REFERENCE(:P_BOOK_NAME);
    SRW.REFERENCE(:ASSET_ID);
    SELECT asset_id,
         lag(life_in_months,1,0) over (PARTITION BY asset_id
                   ORDER BY transaction_header_id_in) Extend_Life
    INTO l_asset_id,
    l_life_in_months
    FROM fa_books
    WHERE book_type_code = 'US GAAP'
    AND asset_id = 1;
    return life_in_months;
    end;
    Has anyone experienced this error before? Does client pl/sql engine not support Analytic functions? The above query runs fine in SQL.
    Thanks,
    Ashish

    From our version of 6i Reports Builder Help, I got ...
    Oracle ORACLE PL/SQL V8.0.6.3.0 - Production
    You may check yours.

  • I need help with Analytic Function

    Hi,
    I have this little problem that I need help with.
    My datafile has thousands of records that look like...
    Client_Id Region Countries
    [1] [1] [USA, Canada]
    [1] [2] [Australia, France, Germany]
    [1] [3] [China, India, Korea]
    [1] [4] [Brazil, Mexico]
    [8] [1] [USA, Canada]
    [9] [1] [USA, Canada]
    [9] [4] [Argentina, Brazil]
    [13] [1] [USA, Canada]
    [15] [1] [USA]
    [15] [4] [Argentina, Brazil]
    etc
    My task is is to create a report with 2 columns - Client_Id and Countries, to look something like...
    Client_Id Countries
    [1] [USA, Canada, Australia, France, Germany, China, India, Korea, Brazil, Mexico]
    [8] [USA, Canada]
    [9] [USA, Canada, Argentina, Brazil]
    [13] [USA, Canada]
    [15] [USA, Argentina, Brazil]
    etc.
    How can I achieve this using Analytic Function(s)?
    Thanks.
    BDF

    Hi,
    That's called String Aggregation , and the following site shows many ways to do it:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    Which one should you use? That depends on which version of Oracle you're using, and your exact requirements.
    For example, is order importatn? You said the results shoudl include:
    CLIENT_ID  COUNTRIES
    1        USA, Canada, Australia, France, Germany, China, India, Korea, Brazil, Mexicobut would you be equally happy with
    CLIENT_ID  COUNTRIES
    1        Australia, France, Germany, China, India, Korea, Brazil, Mexico, USA, Canadaor
    CLIENT_ID  COUNTRIES
    1        Australia, France, Germany, USA, Canada, Brazil, Mexico, China, India, Korea?
    Mwalimu wrote:
    ... How can I achieve this using Analytic Function(s)?The best solution may not involve analytic functions at all. Is that okay?
    If you'd like help, post your best attempt, a little sample data (CREATE TABLE and INSERT statements), the results you want from that data, and an explanation of how you get those results from that data.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on Aug 29, 2011 3:05 PM

  • SQL Server 2008 R2 - Report Builder 3.0 - timeout using shared data source and stored procedure

    I select the shared datasource from the data source propeties dialog, test the connection and everything is good.
    I add a dataset by selecting "use a dataset embedded in my report" option within the Dataset properties dialog.
    I select the newly added data source, click the "Stored procedure" query type and drop down the list box and select my intended stored procedure.
    the timeout for the dataset is "0" seconds.
    I click the "OK" button and I'm presented with the parameters to the stored procedure.
    I enter valid data for the parameters and click the "OK" button.
    I then get the following error message after 30 seconds:
    The problem is, all of the timeouts, that I'm aware of, have values of zero (no timeout) or high enough values that 30 seconds isn't even close to the timeout.
    I think the smallest timeout we have is 120 seconds.
    I have searched this site and many others and the solutions all involve altering the stored procedure to get the fields into report builder and then revert the stored procedure back to its original form.
    To me, this is NOT a solution.  
    I have too many stored procedures that need to be brought into Report Builder.
    I need a real solution.
    Thank you for you time, Tim Caldwell.
    Timothy E Caldwell

    I don't mean to be rude, but really, check to see if the stored procedure can return data rows???
    Maybe I'm not being clear enough.
    The stored procedure runs perfectly fine.
    it runs perfectly fine in the production environment and the test environment.
    I can access the stored procedure in several ways and have it return correct data.
    I can even trick report builder into creating a dataset with parameters and run the stored procedure that way.
    What I cannot do, is to get report builder to not timeout after 30 seconds on the initial creation of a dataset with a Query type of stored procedure.
    I have seen this issues posted again and again and again on may different sites and the "solution" is to simplifiy the stored procedure by creating a stored procedure that has a create table and a select in the stored procedure and that's it.  After
    report builder creates the dataset the developer then has to replace the simplified stored procedure with the actual stored procedure and everything works fine after that.
    HOWEVER, having to go through this process for 70 or more stored procedures is ridiculous.
    It would appear that there is something within report builder itself that is causing this issue.
    The SQL Script included is an example of a stored procedure that will not create fields create a dataset with fields and parameters in Report Builder 3.0:
    USE [CRUM_IT]
    GO
    /****** Object: StoredProcedure [dbo].[COGNOS_Level5ScriptSP] Script Date: 11/17/2014 08:02:26 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER procedure [dbo].[COGNOS_Level5ScriptSP]
    @CompanyCode varchar(8) = null,
    @GetSiblings varchar(1) = 'N'
    as
    Begin
    -- get emergency contact info
    select *
    into #tmp_Contacts
    from
    (select
    ConEEID,
    con.connamelast as [Emer Contact Last Name],
    con.connamefirst as [Emer Contact First Name],
    con.connamemiddle as [Emer Contact Middle Initial/Name]--,
    ,ROW_NUMBER() over (Partition by ConEEID order by ConNameLast)as rn
    ,ISNULL(
    case when con.conphonepreferred = 'H'
    then '(' + substring(con.conphonehomenumber, 1, 3) + ')' + substring(con.conphonehomenumber, 4, 3) + '-' + substring(con.conphonehomenumber, 7, 4)
    else '(' + substring(con.conphoneothernumber , 1, 3) + ')' + substring(con.conphoneothernumber , 4, 3) + '-' + substring(con.conphoneothernumber , 7, 4)
    end,
    ) as [Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.Contacts con
    where con.ConIsEmergencyContact='y'
    and con.ConIsActive='y'
    ) A
    where A.rn = 1
    CREATE TABLE #tmp_CompanyCodes (CompanyCode varchar(8))
    If @GetSiblings = 'Y'
    Begin
    INSERT INTO #tmp_CompanyCodes (CompanyCode)
    EXEC [z_GetClientNumbers_For_ParentOrg_By_ClientNumber] @CompanyCode
    End
    INSERT INTO #tmp_CompanyCodes
    values (@CompanyCode)
    select *
    into #tmp_Company
    from [ultiprosqlprod1].[ultipro_crum].dbo.Company
    where cmpcompanycode in (select CompanyCode from #tmp_CompanyCodes)
    select distinct
    cmpcompanycode as [Client ID],
    CmpCompanyDBAName as [Client Name],
    eec.eecEmplStatus AS [Employment Status],
    eec.eecEmpNo AS [Employee Num],
    rtrim(eep.eepNameLast) AS [Last Name],
    rtrim(eep.eepNameFirst) AS [First Name],
    isnull(rtrim(ltrim(eep.eepNameMiddle)), '') AS [Middle Initial/Name],
    rtrim(eep.eepAddressLine1) AS [Address Line 1],
    isnull(rtrim(eep.eepAddressLine2), '') AS [Address Line 2],
    eep.eepAddressCity AS [City],
    eep.eepAddressState AS [State],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 1, 5)
    ELSE rtrim(eep.eepAddressZipCode)
    END AS [Zip code],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 6, 4)
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) > 0
    THEN substring(eep.eepAddressZipCode, charindex(eep.eepAddressZipCode, '-', 1) + 1, 4)
    WHEN len(eep.eepAddressZipCode) <= 5
    THEN ''
    END AS [ZIP + 4],
    substring(eep.eepSSN, 1, 3) + '-' + substring(eep.eepSSN, 4, 2) + '-' + substring(eep.eepSSN, 6, 4) AS [SSN],
    isnull(convert(VARCHAR(10), eep.eepDateOfBirth, 101), '') AS [Date Of Birth],
    eetFED.TAXCODE AS [FED Tax Code],
    eetFED.FILINGSTATUS AS [Fed Filing Status],
    eetFED.EXEMPTIONS AS [Fed Exemption Allowance],
    eetFED.ADDITIONAL AS [Additional Fed Withholding],
    eetSIT.TAXCODE AS [SIT Tax Code],
    eetSIT.FILINGSTATUS AS [State Filing Status],
    eetSIT.EXEMPTIONS AS [State Exemption Allowance],
    eetSIT.ADDITIONAL AS [Additional State Withholding],
    isnull('(' + substring(eep.eepPhoneHomeNumber, 1, 3) + ')' + substring(eep.eepPhoneHomeNumber, 4, 3) + '-' + substring(eep.eepPhoneHomeNumber, 7, 4), '') AS [Home Phone],
    isnull((SELECT cod.codDesc
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.Codes cod WITH (NOLOCK)
    WHERE cod.codCode = eep.eepEthnicID
    AND cod.codDosTable = 'ETHNICCODE'), '') AS [Race-Origin], --eep.eepEthnicID AS [Race-Origin],
    eep.eepGender AS [Gender],
    isnull(convert(VARCHAR(10), eec.eecDateOfOriginalHire, 101), '') AS [Original Hire Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfSeniority, 101), '') AS [Seniority Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfTermination, 101), '') AS [Termination Date],
    isnull(eecTermType,'') as [Termination Type],
    isnull(TchDesc, '') as [Termination Reason],
    rtrim(eec.eecJobCode) AS [WC Code],
    isnull(eec.eecJobTitle, '') AS [Job Title],
    pgr.pgrPayFrequency AS [Pay Frequency],
    eec.eecFullTimeOrPartTime AS [Full/Part Time],
    eec.eecSalaryOrHourly AS [Pay Type],
    isnull(convert(MONEY, eec.eecHourlyPayRate), 0.00) AS [Hourly Rate],
    isnull(eec.eecAnnSalary, 0.00) AS [Annual Salary],
    [YTD Hours],
    isnull(eep.eepNameFormer, '') AS [Maiden Name],
    eec.eecLocation AS [Location ID],
    rtrim(eec.eecOrgLvl1) AS [Department ID],
    eec.eecorglvl2 AS [Cost Item],
    eec.eecorglvl3 as [Client Project],
    eec.eecPayGroup as [Pay Group],
    isnull(eepAddressEMail,' ') as [Email Address],
    isNull(BankName1,' ') as PrimaryBank,
    isNull(BankRoute1,' ') as PrimaryRouteNum,
    isNull(Account1,' ') as PrimaryAccount,
    isNull(AcctType1,' ') as PrimaryAcctType,
    isNull(DepositRule1,' ') as PrimaryDepositRule,
    isNull(BankName2,' ') as SecondaryBank,
    isNull(BankRoute2,' ') as SecondaryRouteNum,
    isNull(Account2,' ') as SecondaryAccount,
    isNull(AcctType2,' ') as SecondaryAcctType,
    isNull(DepositRule2,' ') as SecondaryDepositRule,
    isNull(
    CASE
    WHEN DepositRule2 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct2 AS decimal(10,2)))
    WHEN DepositRule2 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct2*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as SecondaryDepositAmount,
    isNull(BankName3,' ') as ThirdBank,
    isNull(BankRoute3,' ') as ThirdRouteNum,
    isNull(Account3,' ') as ThirdAccount,
    isNull(AcctType3,' ') as ThirdAcctType,
    isNull(DepositRule3,' ') as ThirdDepositRule,
    isNull(
    CASE
    WHEN DepositRule3 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct3 AS decimal(10,2)))
    WHEN DepositRule3 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct3*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as ThirdDepositAmount,
    Supervisor,
    eec.eecEEID AS [Employee EEID],
    eec.EecJobCode As [Job Code],
    isnull(eec.EecTimeclockID,' ') As [Time Clock ID],
    con.[Emer Contact Last Name],
    con.[Emer Contact First Name],
    con.[Emer Contact Middle Initial/Name],
    con.[Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.empPers eep WITH (NOLOCK)
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.empComp eec WITH (NOLOCK)
    ON eep.eepEEID = eec.eecEEID
    inner join #tmp_Company cmp WITH (NOLOCK)
    ON eec.eecCOID = cmp.cmpCOID
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.PayGroup pgr WITH (NOLOCK)
    ON eec.eecPayGroup = pgr.pgrPayGroup
    left outer join [ultiprosqlprod1].[ultipro_crum].dbo.TrmReasn
    on tchCode = eecTermReason
    left join (select CAST(sum(isnull(eee.eeeYTDHrs,0.00))AS DECIMAL(18,2)) as [YTD Hours],
    eeeEEID,
    eeeCOID
    from [ultiprosqlprod1].[ultipro_crum].dbo.EmpEarn eee with (NOLOCK)
    group by eeeCOID,eeeEEID)eee
    on eec.eecEEID = eee.eeeEEID
    and eec.eecCOID = eee.eeeCOID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode = 'USFIT'
    )eetFED
    ON eec.eecCOID = eetFED.COID
    and eec.eecEEID = eetFED.EEID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode like '%SIT'
    AND eetIsWorkInTaxCode = 'Y'
    )eetSIT
    ON eec.eecCOID = eetSIT.COID
    and eec.eecEEID = eetSIT.EEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName1,
    eddEEBankRoute BankRoute1,
    eddAcct Account1,
    EddAcctType AcctType1,
    EddDepositRule DepositRule1,
    EddAmtOrPct EddAmtOrPct1
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '99')edd
    ON eec.eecCOID = edd.eddCOID
    and eec.eecEEID = edd.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName2,
    eddEEBankRoute BankRoute2,
    eddAcct Account2,
    EddAcctType AcctType2,
    EddDepositRule DepositRule2,
    EddAmtOrPct EddAmtOrPct2
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '01')edd2
    ON eec.eecCOID = edd2.eddCOID
    and eec.eecEEID = edd2.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName3,
    eddEEBankRoute BankRoute3,
    eddAcct Account3,
    EddAcctType AcctType3,
    EddDepositRule DepositRule3,
    EddAmtOrPct EddAmtOrPct3
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '02')edd3
    ON eec.eecCOID = edd3.eddCOID
    and eec.eecEEID = edd3.eddEEID
    left outer join (SELECT eecCOID,
    eecEEID,
    rtrim(eepNameLast) + ', ' +
    rtrim(eepNameFirst) + ' ' +
    isnull(rtrim(ltrim(eepNameMiddle)), '') AS [Supervisor]
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpComp WITH (NOLOCK)
    join [ultiprosqlprod1].[ultipro_crum].dbo.EmpPers with (NoLock)
    on eeceeid = eepeeid)eec2
    ON eec.eecSupervisorID = eec2.eecEEID
    left outer join #tmp_Contacts con
    on eep.eepEEID = con.ConEEID
    order by [Client ID],
    [Last Name],
    [First Name]
    drop table #tmp_Contacts
    END
    Timothy E Caldwell

Maybe you are looking for

  • Cant boot, Read-only filesystem

    Hi guys Sry if this isnt the right section to post, but i didnt find any section in the forum where my problem fit. So, today i was working on my laptop, and at the same time updating the system when the power went down. When the power came back Arch

  • 6.0.2 reading pixel aspect ratio wrong

    Hey, I'm wondering if this is a bug or just my user error. Here's the scoop. I have a ProRes HQ master that is 1920 x 1080p. When I open it in QT 7 or 10 or VLC it shows the proper aspect ratio. When I open it in Compressor it shows it is square pixe

  • Trouble with ipod touch time

    everytime it connects it puts the ipod with a wrong time for example is should say right now 10.32 but when i connect it to the computer it resets it to 9.32 ,one hour dif.I have tried everything to put it normal,restoring,restoring settings everythi

  • Tiger Quicken to Leopard?

    Reinstalling Leopard. How do I install quicken 06 from my Tiger disk onto my imac after I reinstall leopard?

  • Why does the FF 3.6.15 lock my PC? Only forced power off cures.

    Since this version of FF loaded a few days ago, my PC locks after a few minute use. Nothing responds, CTRL+ALT+DEL does nothing. Only a force power down can get the PC running again. You will not get a FF fail report so you may not be aware of this p