SQL Command table linking issues

I have created a simple SQL command in CR 2008 to save the creation of a view on the DB (SQL Server 2005).  I then link it to another table from the same DB.  Once this was done I began experiencing extremely long run times versus the link with the original view.  The SQL command set was copied directly from the view in MS Visual Sudio.  The joins in CR are left outers and inner that worked fine with the original view.  We ended up running a trace of the SQL Server and found the SQL was producing 21,000 record reads everytime the primary table read a record.  It was not following the inner join at all.  I did a Show SQL in CR and found that the CR generated SQL looked very strange and not like the typical construction when the view was being used instead of the table  What am I doing wrong?  Below is a copy of the Show SQL for this particular issue.  It seems to be the second command set in italics that causes the issue.  That is from the SQL command I created in CR.
Thanks,
Brian
PROD - FIN
SELECT "MAN_JOBS"."JOB_NUMBER", "MAN_JOBS"."ACTUAL_START_DATE", "MAN_JOBS"."ACTUAL_START_DATE_2", "MAN_JOBS"."STD_PROCESS_SPEC", "MAN_JOBS"."COMPANY_CODE"
FROM   "fin_prod"."dbo"."MAN_JOBS" "MAN_JOBS"
EXTERNAL JOIN MAN_JOBS.STD_PROCESS_SPEC={?PROD - FIN: C_IC_PRODUCT_CHARACTERISTICS.PART_CODE} AND MAN_JOBS.COMPANY_CODE={?PROD - FIN: C_IC_PRODUCT_CHARACTERISTICS.COMPANY_CODE} AND MAN_JOBS.COMPANY_CODE={?PROD - FIN: KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE} AND MAN_JOBS.JOB_NUMBER={?PROD - FIN: KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.DOCUMENT_NUMBER} AND MAN_JOBS.STD_PROCESS_SPEC={?PROD - FIN: KX_PRODUCT_MASTER_EXT.PART_CODE}
PROD - FIN
SELECT *
FROM dbo.IC_PRODUCT_CHARACTERISTICS
WHERE (CHARACTERISTIC_CODE = 'TEXT')
EXTERNAL JOIN C_IC_PRODUCT_CHARACTERISTICS.PART_CODE={?PROD - FIN: MAN_JOBS.STD_PROCESS_SPEC} AND C_IC_PRODUCT_CHARACTERISTICS.COMPANY_CODE={?PROD - FIN: MAN_JOBS.COMPANY_CODE}
PROD - FIN
SELECT "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."IC_MOVE_QUANTITY", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."TRANSACTION_TYPE", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."IC_LOT_NUMBER", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."WAREHOUSE", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."PERIOD_TXT", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."YEAR_TXT", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."DOCUMENT_NUMBER", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."PART_CODE", "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."COMPANY_CODE"
FROM   "fin_prod"."dbo"."KX_IC_MOVEMENTS_PRODCTN_IN_OUTS" "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"
WHERE  "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."COMPANY_CODE"={?PROD - FIN: MAN_JOBS.COMPANY_CODE} AND "KX_IC_MOVEMENTS_PRODCTN_IN_OUTS"."DOCUMENT_NUMBER"={?PROD - FIN: MAN_JOBS.JOB_NUMBER}
EXTERNAL JOIN KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PART_CODE={?PROD - FIN: PRODUCT_MASTER.PART_CODE} AND KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE={?PROD - FIN: PRODUCT_MASTER.COMPANY_CODE}
PROD - FIN
SELECT "PRODUCT_MASTER"."PRODUCT_CLASS", "PRODUCT_MASTER"."COMPANY_CODE", "PRODUCT_MASTER"."PART_CODE"
FROM   "fin_prod"."dbo"."PRODUCT_MASTER" "PRODUCT_MASTER"
WHERE  "PRODUCT_MASTER"."PART_CODE"={?PROD - FIN: KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PART_CODE} AND "PRODUCT_MASTER"."COMPANY_CODE"={?PROD - FIN: KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE}
PROD - FIN
SELECT "KX_PRODUCT_MASTER_EXT"."PRODUCT_CLASS", "KX_PRODUCT_MASTER_EXT"."PART_CODE"
FROM   "fin_prod"."dbo"."KX_PRODUCT_MASTER_EXT" "KX_PRODUCT_MASTER_EXT"
WHERE  "KX_PRODUCT_MASTER_EXT"."PART_CODE"={?PROD - FIN: MAN_JOBS.STD_PROCESS_SPEC}

As an update, I created a view in MS VIsual Studio and copied the SQL command set into a Crystal SQL command and made changes in the report to use the new CR SQL command.  It ran in seconds instead of hours.  There is something wrong with the way CR is building the SQL command when a CR SQL command is linked to a normal DB table.  HELP!  I started using the CR SQL command with only another 1 or 2 tables and it was slower but bearable.  This one uses more table and more data and dies.  Here is what the SQL command set looks like that I built in MS VS and used to create the CR SQL command.  This is from the Show SQL in CR.
SELECT        dbo.MAN_JOBS.ACTUAL_START_DATE, dbo.MAN_JOBS.ACTUAL_START_DATE_2, dbo.MAN_JOBS.JOB_NUMBER,
                         dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.DOCUMENT_NUMBER, dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.IC_LOT_NUMBER,
                         dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.IC_MOVE_QUANTITY, dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PART_CODE,
                         dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PERIOD_TXT, dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.YEAR_TXT,
                         dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.TRANSACTION_TYPE, dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.WAREHOUSE,
                         dbo.PRODUCT_MASTER.PRODUCT_CLASS, dbo.KX_PRODUCT_MASTER_EXT.PART_CODE AS KX_PART_CODE,
                         dbo.KX_PRODUCT_MASTER_EXT.PRODUCT_CLASS AS KX_PRODUCT_CLASS, dbo.IC_PRODUCT_CHARACTERISTICS.CHARACTERISTIC_CODE,
                         dbo.IC_PRODUCT_CHARACTERISTICS.IC_DEF_CHAR_TEXT
FROM            dbo.MAN_JOBS INNER JOIN
                         dbo.IC_PRODUCT_CHARACTERISTICS ON dbo.MAN_JOBS.COMPANY_CODE = dbo.IC_PRODUCT_CHARACTERISTICS.COMPANY_CODE AND
                         dbo.MAN_JOBS.STD_PROCESS_SPEC = dbo.IC_PRODUCT_CHARACTERISTICS.PART_CODE LEFT OUTER JOIN
                         dbo.KX_PRODUCT_MASTER_EXT ON dbo.MAN_JOBS.STD_PROCESS_SPEC = dbo.KX_PRODUCT_MASTER_EXT.PART_CODE AND
                         dbo.MAN_JOBS.COMPANY_CODE = dbo.KX_PRODUCT_MASTER_EXT.COMPANY_CODE LEFT OUTER JOIN
                         dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS ON dbo.MAN_JOBS.COMPANY_CODE = dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE AND
                         dbo.MAN_JOBS.JOB_NUMBER = dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.DOCUMENT_NUMBER LEFT OUTER JOIN
                         dbo.PRODUCT_MASTER ON dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.COMPANY_CODE = dbo.PRODUCT_MASTER.COMPANY_CODE AND
                         dbo.KX_IC_MOVEMENTS_PRODCTN_IN_OUTS.PART_CODE = dbo.PRODUCT_MASTER.PART_CODE
WHERE        (dbo.IC_PRODUCT_CHARACTERISTICS.CHARACTERISTIC_CODE = N'TEXT')

Similar Messages

  • Table linking issue

    Working with Crystal Reports 11. Fairly new to this, but I am little confused.
    Working with 3 tables.
    Table 1 is a list of all the details of customers with a CUSTOMER_CODE field
    Table 2 is all the invoices of customers also with a CUSTOMER_CODE and an INVOICE_NO field
    Table 3 is all the details for the invoice table also linked with a CUSTOMER CODE and a INVOICENO field
    Have links via CUSTOMER_CODE to all three tables and have the INVOICE_NO field linked between Table 2 and Table 3.
    The problem that is occuring is there is a few CUSTOMER_CODES in TABLE 2 and TABLE 2 that are not available in TABLE 3. So when I try and run a report containing any additional information from TABLE 1 it will exclude the CUSTOMER_CODES that are not available to be linked.
    Was hoping via an IF statement I could resolve this but no luck. CUSTOMER_CODE is a mix of alphanumeric so it is a string.
    if ="99999" then "Cash Sale"
    else
    Same problem all the 99999 accounts get eliminated from the report. CUSTOMER_CODE 99999 does not exist in Table 1, but can be found in Table 2 and Table 3.

    Hi Andy,
    Don't go too link crazy, or you'll get unexpected results.
    Based on what you're describing, it sounds like Customers are your parent records, invoices child to customers, and invoice details child to invoices.
    You should not have a link from customers to invoice details.
    Link: Customers to Invoices and invoices to details. There should be no link between customers and details.
    Then, what you need to do is click on the table links, right click, and select change join type. Depending on how you've linked the tables (directionally) you may need either a left outer, or a right outer join. You could potentially also use a full outer join, but that will give you all customers without invoices, as well as all invoices without matching customers. Try one, and if that doesn't work, try the other.
    A left outer join takes the two tables, and says 'give me all of the records on the table on the left, regardless if there is a corresponding record in the table on the right, and all right table records that 'belong' to records on the left table'
    Crystal determines which table is 'left' and which is 'right' based on which table you linked FROM. It takes the FROM table, and calls it the left.
    Hope that helps.
    -R

  • Sql command from function issue during print report

    Hi guys,
    i have some problem with my report and his subreport that call data from SQL Function.
    I recompile the function and update the report, if I use the Crystal preview i show the correct data, but when I attach this report to SAP i show the old data hat I have before modify my function.
    Please help me.
    Thank you a lot!!!

    Please define "attach to SAP". What does that mean?
    - Ludek

  • SQL command to select first record

    I would like to create an SQL command to link two tables on a field so that only the first matching record is selected. What would be the syntax for that? Thank you.

    Actually, that's not as simple as it sounds...  It also depends on your definition of "first", and what data you are looking for.
    For example, if you are looking for the earliest order date for each of your customers, you could do something like:
    select customer.code, customer.name, min(order.date) as First_Order_Date
    from customer, order
    where customer.code = order.cust_code
    group by customer.code, customer.name
    But if you also want the sales dollars for that first order, you'd have to do something like:
    select customer.*, firstOrder.first_order_date, sales.sales
    from customer
    join (
      select cust_code, min(date) as first_order_date
      from order
      group by cust_code
    ) firstOrder
    on customer.code = firstOrder.cust_code
    join (
      select cust_code, date, sum(sales) as sales
      from order_detail
      group by cust_code, date
    ) sales
    on firstOrder.cust_code = sales.cust_code and firstOrder.First_Order_Date = sales.date
    HTH,
    Carl

  • How to update the connection of a "command table"?

    We use DataSets with MySQL ODBC connections to pass the data to the report with setDataSource() in C#.
    The report works fine until we try to add a SQL Command Table. We get the usual "Failed to open the connection.":
    Crystal Report Windows Forms Viewer
    Failed to open the connection.
    Failed to open the connection.
    PerformanceReport(cas) {F752A44A-9725-49D8-9F08-BCD752CCAA0E}.rpt
    Of course, the connection used to design the report doesn't exist on the production PC.
    How can we resolve this?
    We use Crystal Reports 2008 v12.0.0.683 with Visual Studio .NET 2008 SP.

    Crystal Reports 2008 v12.0.0.683 was not supported with .NET 2008. You must apply at least Service pack 1:
    https://smpdl.sap-ag.de/~sapidp/012002523100006555792009E/cr2008win_sp1.exe
    See if that helps.
    One thing I am not clear on is; how are you adding the SQL Command Table? Can you add the Command Table to the report in the CR designer?
    Ludek

  • Convert table linked report into a Command version - Howto?

    How can I convert hundreds of reports from table linked into a Command version?
    One way to do is to take the SQL syntax off the report, add a Command with that Syntax and manually replace the database fields by the Command fields.
    I can not believe that is the right way to this. Is there no hidden (re-)mapping fields button or another undocumented feature?
    If this is the way to do it... when will there be a one-button-click solution. The underlaying data keeps the same, could not be that hard to build..?
    Without that basic functionality Crystal Reports is not option for us anymore.
    Backgroud: We do have hundreds of reports that are created by an ODBC (RDO) database (SQL Anywhere database), created by linking the tables and select the fields we like to use in the report. This works fine at least as we used the RDC method in our application. Because we are moving to .NET we could not use RDC anymore and have to use the .NET methods. However the .NET SDK is very limited. The only way to add more complex WHERE statements is to use the Command functionality of Crystal Reports.

    Hi Hans,
    Let me explain, Command Objects are sent directly to the DB server as is. CR does not alter the SQL at all. As you know in SQL there are minor differences between the various servers and the SQL syntax can vary from DB to DB. Because of this CR could not build in the logic to handle the vast number of potential mappings, and not jsut SQL types but also PC databases.
    To be able to map reports based on connections directly to the DB through a Command object the current versions of CR do not have the ability. Possibly the next version may have this feature though but we can't say for sure until it's released. Check our WEB site for new versions and there functionality.
    Next question about moving off of the RDC to .NET, you are correct. CR no longer allows you to modify the SQL statement directly. The RDC was actually supposed to stop you also but it did work.
    One possible solution is to use .NET and inProc RAS ( Report Application Server) and using record sets. Your app can get the SQL from the report, process the query and appending the info onto the WHERE clause as well as other filtering and then set the existing reports data source to the record set. As long as your data is less than 5000 rows then no performance issues, over 5K and you may start to see slow report processing. Depends on other info and report complexity etc.
    If this is an option for you please post your question to the Crystal .NET development forum. Also, you will need to use 12.x.2000.x versions of the CR .NET assemblies and not use the basic version 10.5 or 10.2 that comes with .NET 2008 and 2005.
    Thank you
    Don

  • Delete table in SQL command

    Hello,
    As part of my report I populate a table then reference it in several following subreports.
    The issue I'm having is that I need to clear all the data from my table after using it to allow the report to run again (and not get multiple results)
    To do this I have tried to add a sub report at the very end (and start) of my report with the SQL command truncate table <tablename> or delete <tablename> or delete <tablename> where 1 = 1.
    When I try truncate I get an error saying that I don't have permission (despite granting it but hey...) which is why I switched to delete, this runs fine but the table doesn't get deleted...
    Any thoughts as to why this isn't working/how I can clear my table? I have thought of setting up a separate scheduled job to delete the table contents however I do also need to run the report several times with different parameters so this isn't an ideal solution.
    I have tried adding a select after my delete statement as I thought if it had something to display on the report it would have to look at it but this didn't make any difference.
    Any help will be much appreciated!
    Thanks
    Chris

    Thanks for that!
    I have had a go at this and I can see how it will work although I have limited access on the Crystal userid I have so will need to have the SP created as part of our nightly refresh script I think.
    Is there no way of getting crystal to run my delete statement otherwise?
    Thanks again
    Chris

  • Issue while accessing a SQL Server table over OTG

    Hi,
    I have been learning oracle for about 1.5 years and am just starting to learn some OTG pieces. I am wondering about an issue. The issue is:
    "We need help with an issue we are having while accessing a SQL Server table over OTG. We are getting the following error message in Oracle :
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Oracle][ODBC SQL Server Driver]Unicode conversion failed {HY000}
    The column it is failing on is "-----------" in the view --------------- in the SQL Server database pointed to by the Oracle DB Link ------------------- thats created in the Oracle instances ---- and -----.
    This was working before, but is now failing, we suspect its due to new multi-byte data being added to the base table in the above column."
    I took out the details and added ---- instead. I am wondering your guys thoughts on fixing this issue and helping me learn along the way. Thanks

    Hi Mike,
    Thanks for the response, here are the details:
    1. What is the character set of the Oracle RDBMS being used. What is returned by -
    select * from nls_database_parameters;
    NLS_CHARACTERSET
    AL32UTF8
    NLS_NCHAR_CHARACTERSET
    UTF8
    We get SQL_Latin1_General_CP1_C1_AS and 1252 as Collation Property and Code Page
    The datatype of the column in question in SQL Server is nvarchar(100).
    When I do a describe on the SQL Server view ( desc CK_DATA_FOR_OPL@------- ), I get the error below;
    ERROR: object CK_DATA_FOR_OPL does not exist
    Select * from CK_DATA_FOR_OPL@------ where rownum =1 does get me a row.
    create table tmp_tab as
    Select * from CK_DATA_FOR_OPL@----- where rownum =1;
    desc tmp_tab shows the datatype of the said column in the table created in Oracle as NVARCHAR2(150).
    Not sure why a column defined with size 100 in SQL Server should come across as 150 when seen over OTG. We see something similar in DB2 tables we access over OTG as well.
    Edited by: 993950 on Mar 15, 2013 8:49 AM

  • How to see all sql statements on sql commands under history link

    Hi All,
    How to see the all the sql history on sql commands tab.
    I want see all sql statements.
    Where to set if we need to store more sql statments in history.
    We are using Apex3.2 and 10g database(EE).
    Thanks,
    Nr

    I just checked the source code of the SQL commands history region and that report fetches a maximum of 1000 records. I don't know if you change the setting somewhere in the builder, but seeing the code it looks as though 1000 is hard-coded in the report definition(apex 4.0).
    If you need to see all the command history,you can query the original table: APEX_040000.WWV_FLOW_SW_SQL_CMDS
    Note that is an internal table used by apex and hence you might not find any documentation about it(google got me one valid hit: Identifying Inactive Workspaces which seem to confirm the table's use).
    Anyway, here's what you need to do, ask your dba to grant your workspace user select access on this table
    Connect as dba user and run
    GRANT SELECT ON APEX_040000.wwv_flow_sw_sql_cmds to '<WORKSPACE SCHEMA>'Now you can run the following command from your workspace to see the entire command history using
    select * from APEX_040000.WWV_FLOW_SW_SQL_CMDS where parsed_schema = '<WORKSPACE SCHEMA>';You might want to revoke the grant once you have seen the data/taken out an export due to security issues.

  • Using unlinked sql command and table in a subreport

    All,
    Does CR allow using an unlinked sql command and a table in the same subreport?  I am passing the CurrentCEUserName from the main report to the sql command in the subreport (via linked parameter).  The sql command then executes a query to pass the parameter to the database (example: select myfunction('{?myparam}' from dual).  I need this to run before subreport's table query is executed. 
    This all appears to work except that the parameter passed to the sql command isn't set when the command executes.  The value is always null when the sql command is executed.  If I add the parameter to the report output it shows the expected value. 
    Also, if I have a subreport that just has a single sql command the parameter is set correctly prior to executing the command.
    any help would be appreciated.
    thanks!

    If you are looking for Crystal to run the SQL Command, then the SQL it generates itself, I think the answer is no, it won't do that.  Crystal expects all of the data sources to be linked, I believe.  I'm not sure what you would expect to happen if they are not...  However, you can make your SQL Command something like (MS SQL; sorry, it's been too long since I've used Oracle...):
    declare @result varchar(100);
    set @result = ( select myfunction('{?myparam}') );
    select * from table;
    which would run the first select calling your function, basically throw away the result (or you can do with it as needed), then return the fields from your table.
    HTH,
    Carl

  • APEX - SQL Workshop - SQL Commands : Issue in extracting hour from date

    Hello All,
    When I run
    SELECT to_char(sysdate,'hh24') from DUALon SQL Developer and APEX SQL Commands window, both are returning correct hour value.
    But when I run
    SELECT to_char(i_date,'hh24') from t_factthen I'm getting correct values in SQL Developer but not in APEX SQL Commands window. In APEX, it always returns '00' for all rows. I'm totally lost what could be the issue with APEX? Any suggestions?
    DB Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    APEX Version: 4.0.1.00.03
    Web Server : EPG
    Table structure:
    CREATE TABLE  "T_FACT"
       (     "TF_KEY" NUMBER,
         "TOWER" VARCHAR2(20),
         "LOC_ID" NUMBER,
         "TF_CAT" VARCHAR2(35),
         "EQP_NAME" VARCHAR2(35),
         "I_DATE" DATE,
         "MON_CATEGORY" VARCHAR2(35),
         "EVENT" VARCHAR2(35),
         "UNIT" VARCHAR2(35),
         "TF_VALUE" NUMBER
       );Regards,
    Hari

    Hi,
    Just silly question case you have same table in multiple schemas:
    You run query in same schema?
    Regards,
    Jari

  • How can I search multiple columns in a SQL command of Union tables

    Hi:
    We have a database with tables that are nearly identical that we use for production and production history.
    I have created an SQL command in Crystal 2008 to joins several of the tables and then added a "UNION" to connect the History and Prod tables.
    I need to search multiple (3 total) columns for 5 different data types, to return the records being investigated. I tried this using an "OR" statement in the where clause and have had inconsistant results.
    The first two or statement function perfectly the third works as long as the value being passed is numeric and the last two fail consistantly with invalid column name errors. It appears that crystal is getting confused and passing the wrong data type especially if I do a new search using a different option for the "?SearchParam"
    Can some one offer some insite on how I can search these fields to return the record data needed
    -- {?SearchParam} is the search parameter passed by Crystal that is a number 1 thru 5
    -- {?Search_Val} is a parameter that is passed by Crystal that is a string of what to search for 1 = Numeric CMP ord #("TBSLI21"."LI21_OR_NO"), 2 = Numeric CI ord # ( "TBSLI33"."LI33_CI_OR_NO"),
    --   3 =String  Ext Sys ord string ("TBSLI33"."LI33_EXT_SYS_SL_OR_NO"), 4 = String CMP Grp string ("TBSLI21"."LI21_OP_GRP_NO"), 5 = composit string PP ord string ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")
    SELECT "TBSLI21"."LI21_OR_NO",
    "TBSLI21"."LI21_SH_DT_SCDL",
    "TBSLI21"."LI21_TS_EN_ORIG",
    "TBSLI21"."LI21_TS_SHIP",
    "TBSLI21"."LI21_SYS_ORD_CD",
    "TBSLI21"."LI21_SHIP_ID",
    "TBSLI21"."LI21_WRKST_ID",
    "TBSLI21"."LI21_LI_NO",
    "TBSLI33"."LI33_CI_OR_NO",
    "TBSLI33"."LI33_EXT_SYS_SL_OR_NO",
    "TBSLI21"."LI21_OP_GRP_NO",
    "TBSLI21"."LI21_LI_STAT",
    "TBSOP13"."OP13_OP_GRP_STAT",
    "TBSLI31"."LI31_LI_EV_DTL_TX",
    "TBSLI31"."LI31_DT_EN",
    "TBSLI31"."LI31_TM_EN",
    "TBSLI31"."LI31_LI_EV",
    "TBSLI21"."LI21_OP_WSH_FLNM",
    "TBSLI21"."LI21_PR_ITF_CD",
    "TBSLI21"."MFG_PLANT_CD",
    "MFG_PLANT_LI"."MFG_PLANT_CD" as PrefPlant,
    "TBSOP13"."OP13_OP_GRP_DSP_CD",
    "TBSLI21"."LI21_LI_DSP_CD",
    "TBSOP13"."OP13_CLR_DAY",
    "TBSOP13"."OP13_PP_GRP_SEQ_NO",
    "TBSOP13"."OP13_CELL_ID",
    "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG",
    "TBSLI21"."LI21_OP_GRP_PS_NO1",
    "TBSLI21"."LI21_POMS_MERGE_NO",
    "TBSLI31"."LI31_OP_ID",
    "TBSLI21"."LI21_LI_POR_FG",
    "TBSLI21"."LI21_BIN_ID",
    "TBSLI21"."LI21_TS_MRSHL",
    "TBSLI33"."LI33_CI_LI_NO",
    "TBSLI33"."LI33_SH_ADDR_1",
    "TBSLI33"."LI33_SH_ADDR_2",
    "TBSLI33"."LI33_SH_ADDR_3",
    "TBSLI33"."LI33_SH_ADDR_4",
    "TBSLI33"."LI33_SH_CITY_NM",
    "TBSLI33"."LI33_SH_ST_NM",
    "TBSLI33"."LI33_SH_ZIP_CD",
    "TBSLI33"."LI33_CU_NM",
    "TBSLI33"."LI33_CU_BUS_NM"
    FROM   ((("CMPREPORTING"."dbo"."TBSLI33" "TBSLI33" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21" "TBSLI21" ON ("TBSLI33"."LI33_BS_OR_NO"="TBSLI21"."LI21_OR_NO") AND ("TBSLI33"."LI33_BS_LI_NO"="TBSLI21"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13" "TBSOP13" ON "TBSLI21"."LI21_OP_GRP_NO"="TBSOP13"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31" "TBSLI31" ON ("TBSLI21"."LI21_OR_NO"="TBSLI31"."LI31_OR_NO") AND ("TBSLI21"."LI21_LI_NO"="TBSLI31"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI" "MFG_PLANT_LI" ON ("TBSLI21"."LI21_OR_NO"="MFG_PLANT_LI"."OR_NO") AND ("TBSLI21"."LI21_LI_NO"="MFG_PLANT_LI"."LI_NO")
    WHERE   {?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int)
    or {?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0))
    or {?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val})
    or {?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo})
    or {?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})
    Union
    SELECT "TBSLI21_HIST"."LI21_OR_NO",
    "TBSLI21_HIST"."LI21_SH_DT_SCDL",
    "TBSLI21_HIST"."LI21_TS_EN_ORIG",
    "TBSLI21_HIST"."LI21_TS_SHIP",
    "TBSLI21_HIST"."LI21_SYS_ORD_CD",
    "TBSLI21_HIST"."LI21_SHIP_ID",
    "TBSLI21_HIST"."LI21_WRKST_ID",
    "TBSLI21_HIST"."LI21_LI_NO",
    "TBSLI33_HIST"."LI33_CI_OR_NO",
    "TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO",
    "TBSLI21_HIST"."LI21_OP_GRP_NO",
    "TBSLI21_HIST"."LI21_LI_STAT",
    "TBSOP13_HIST"."OP13_OP_GRP_STAT",
    "TBSLI31_HIST"."LI31_LI_EV_DTL_TX",
    "TBSLI31_HIST"."LI31_DT_EN",
    "TBSLI31_HIST"."LI31_TM_EN",
    "TBSLI31_HIST"."LI31_LI_EV",
    "TBSLI21_HIST"."LI21_OP_WSH_FLNM",
    "TBSLI21_HIST"."LI21_PR_ITF_CD",
    "TBSLI21_HIST"."MFG_PLANT_CD",
    "MFG_PLANT_LI_HIST"."MFG_PLANT_CD",
    "TBSOP13_HIST"."OP13_OP_GRP_DSP_CD",
    "TBSLI21_HIST"."LI21_LI_DSP_CD",
    "TBSOP13_HIST"."OP13_CLR_DAY",
    "TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO",
    "TBSOP13_HIST"."OP13_CELL_ID",
    "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG",
    "TBSLI21_HIST"."LI21_OP_GRP_PS_NO1",
    "TBSLI21_HIST"."LI21_POMS_MERGE_NO",
    "TBSLI31_HIST"."LI31_OP_ID",
    "TBSLI21_HIST"."LI21_LI_POR_FG",
    "TBSLI21_HIST"."LI21_BIN_ID",
    "TBSLI21_HIST"."LI21_TS_MRSHL",
    "TBSLI33_HIST"."LI33_CI_LI_NO",
    "TBSLI33_HIST"."LI33_SH_ADDR_1",
    "TBSLI33_HIST"."LI33_SH_ADDR_2",
    "TBSLI33_HIST"."LI33_SH_ADDR_3",
    "TBSLI33_HIST"."LI33_SH_ADDR_4",
    "TBSLI33_HIST"."LI33_SH_CITY_NM",
    "TBSLI33_HIST"."LI33_SH_ST_NM",
    "TBSLI33_HIST"."LI33_SH_ZIP_CD",
    "TBSLI33_HIST"."LI33_CU_NM",
    "TBSLI33_HIST"."LI33_CU_BUS_NM"
    FROM   ((("CMPREPORTING"."dbo"."TBSLI33_HIST" "TBSLI33_HIST" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21_HIST" "TBSLI21_HIST" ON ("TBSLI33_HIST"."LI33_BS_OR_NO"="TBSLI21_HIST"."LI21_OR_NO") AND ("TBSLI33_HIST"."LI33_BS_LI_NO"="TBSLI21_HIST"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13_HIST" "TBSOP13_HIST" ON "TBSLI21_HIST"."LI21_OP_GRP_NO"="TBSOP13_HIST"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31_HIST" "TBSLI31_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="TBSLI31_HIST"."LI31_OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="TBSLI31_HIST"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI_HIST" "MFG_PLANT_LI_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="MFG_PLANT_LI_HIST"."OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="MFG_PLANT_LI_HIST"."LI_NO")
    WHERE  {?aSearchParam} = 1 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21_HIST"."LI21_OR_NO"= Cast( {?Search_Val} as Int)
    or {?aSearchParam} = 2 and  "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33_HIST"."LI33_CI_OR_NO"= Cast( {?Search_Val} as numeric(12,0))
    or {?aSearchParam} = 3 and  "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20), "TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20),{?Search_Val})
    or  {?aSearchParam} = 4 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21_HIST"."LI21_OP_GRP_NO")= Convert( VarChar(8), {?GroupNo} )
    or {?aSearchParam} = 5 and  "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13_HIST"."OP13_CLR_DAY" & "TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO" & "TBSOP13_HIST"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})

    This is actually a fairly easy fix - because of the way the "OR" works in SQL, you need to surround each "set" of statements in the or with parentheses.  So, it would look something like this:
    Where
    ({?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int))
    or
    ({?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0)))
    or
    ({?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val}))
    or
    ({?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo}))
    or
    ({?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo}))
    -Dell

  • Crystal Reports XI does not allow to change Table to SQL command?

    I have report that has Table in Datasource and this table used in report and all fileds are mapped. I need to change table to SQL Command with the same result set of collumns. When I try to Update in Set Datasource Location - it does not work. CR XI allow to update Command to table but Table to Command just do nothing.
    What I have to do or how I can do it?

    Alexander,
    That's probably the "Best" way to do it, and long term you'll want to start adding BOE to your work flow.
    If you want to get around it, here how:
    1) MAKE A COPY OF YOUR REPORT AND WORK FROM THE COPY!!! This involves some a good deal of destruction before you get into reconstruction.
    2) Once you have created your command, remove the table.
    3) Now the fun part... Go through report and manually change all references to the 1st table...
       report fields
       formulas
       selection criteria
       groups
       the whole 9 yards...
    A short cut for the future... If you make all of your formula copies of all of your fields ( fCustomerName = {Table.CustomerName} ) and then only use the formula version of the field in the reports, you can make these changes very easily. (All you have to do is update the one set of formulas.)
    Also as a side note before you get started... You may want to think twice before you mix commands with tables. You loose the server side filtering and grouping on the tables when you do that.  So if you have several tables, you are better off doing the whole thing in one SQL command, do all of your filtering and sorting there and use it to replace ALL of your tables.
    Basically, Graham's way is the easy way... Assuming you have access to the BOE.
    Jason

  • Member acces profile error(A table name, specified in an sql command)

    Hi friends,
    In my bpc application(A) below 3 dims are secure dims.
    1. entiiy  (std)
    2. category (std)
    3. location (custom dim)
    while defining one member access profile,
    Read Only      : CATEGORY 100
    Read & Write      : CATEGORY 200,500
    for whatever combinatio i use, for other secure dims (eg: category,location where base member,or parent members ) i'm getting below error  message
    A table name, specified in an sql command, is unknown.
    We are on bpc75nw sp04.
    Pls suggest us .
    dump(st22):
    Short text
        A table name, specified in an SQL command, is unknown.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "CL_UJE_MEMACCESS_CACHE========CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS', was
         not caught in
        procedure "REMOVE_MEMACCESS" "(METHOD)", nor was it propagated by a RAISING
         clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        An invalid table name "/1CPMB/RDWCSUMAS" was specified in an Open SQL command:
        Due to one of the following reasons, the error occurs only at runtime:
        - the table name was specified dynamically, or
        - the SELECT clause, WHERE clause, GROUP-BY clause, HAVING clause, or
          ORDER-BY clause was specified dynamically.
    Thanks,
    naresh
    Edited by: Naresh P on Feb 19, 2011 10:40 AM

    Hi Naresh,
    As far as I know You have specify Explicit Access to all the dimensions mentioned as Secured in your Application.
    You can't skip the secured Dimesions.
    In your case if you want to restrict only one dimension for 1 Member Access Profile then give Read & Write access to other 2 Dimensions and select ALL members.
    This might solve your problem.
    Hope it helps.
    Chaithanya

  • Issuing SQL command through  Forms

    Hi
    How we can issue SQL command e.g. CREATE USER, through Forms.
    Regards!

    Issues dynamic SQL statements at runtime, including server-side PL/SQL and DDL.
    Note All DDL operations issues an implicit Commit
    Syntax
    Function FORMS_DDL(statement VARCHAR2);
    If you use FORMS_DDL to executed a valid PL/SQL Block:
    If you user FORM_DDL to executed a single DML or DDL stmt :
    Omit the trailing semicolon to avoid an invalid character error
    Thanks

Maybe you are looking for

  • Distinct

    hello, is there any possibility in Forms to suppress duplicates. For example an attribute of forms...

  • READ_ERROR_FROM_CLIENT

    When I try and attach a large file through the wl-proxy, I get a READ_ERROR_FROM_CLIENT: trying to POST /jive4/attach.jspa, Client-Auth reports: Cannot buffer client data -wl-proxy reports: IO error reading POST data at line 628 of proxy.cpp, system

  • AS3 array used to load and play random swfs?

    Hi, I'm trying to use an array adapted from AS2 script to load random swfs called "koan_1.swf" or "koan_2.swf" etc into a "koan_loader_mc" on the stage.  Each "koan_#.swf" has code in its last frame to both advance the "shuffle" array in the action s

  • Map more than one drive in AD

    Aslam-O-Alikum, I want to map more then one network mapped drives in active directory. is there any solution for this.  I am using win server 2012R2, already mapped one drive for users. Some resources i want to share with all users, for this purpose

  • Pages Icon changed after upgrade

    I recently upgraded from iWork 08 to iWork09. In the upgrade all of my Pages documents now have the Keynote icon. Keynote documents retained their own icon as did the Numbers documents. How do I get the Pages Icon back on all my Pages documents with