Nested where clause sql??

Hello,
I try to do the following sql
select a.emplid from
tableA a
where a.effdt =
(select max(b.effdt) from tableA b where a.emplid = b.emplid)
I try to use filter, it does not work, it complain that the table does not exist.
Please advise?
thnks

Currently OWB does not support subqueries. It will be supported in the next major version (November 2004).
In the meantime the (not very elegant) workaround for this is to create a view with the nested query.
Regards:
Igor

Similar Messages

  • Where Clause SQL Loader

    Hi,
    Please could someone give me the syntax for expressing a where clause in SQL Loader control file? as an example i only want the data in the columns to be uploaded where person_id matches the person_id already present in the table.
    My control file is below which needs amending to include a 'Where'. The append will also need changing i assume.
    load data
    infile '/app/DEV/appl/xxcpp/11.5.0/bin/TEST.csv'
    APPEND
    into table XXCPP_SQL_LOADER_TEST
    fields terminated by "," optionally enclosed by '"'
    ( PERSON_ID, EMP_NAME, EMP_NUMBER, START_DATE DATE "fmDD/MM/RRRR" )
    Many Thanks

    SQL*Loader has very limited conditional load capabilities. WHEN clause does not support OR (and it is documented). Anyway, you could do the following. Control file:
    load data
    infile *
    APPEND
    into table XXCPP_SQL_LOADER_TEST
    When Person_id = '1'
    fields terminated by "," optionally enclosed by '"'
    ( PERSON_ID POSITION(1), EMP_NAME, EMP_NUMBER, START_DATE DATE "fmDD/MM/RRRR" )
    into table XXCPP_SQL_LOADER_TEST
    When Person_id = '2'
    fields terminated by "," optionally enclosed by '"'
    ( PERSON_ID POSITION(1), EMP_NAME, EMP_NUMBER, START_DATE DATE "fmDD/MM/RRRR" )
    into table XXCPP_SQL_LOADER_TEST
    When Person_id = '3'
    fields terminated by "," optionally enclosed by '"'
    ( PERSON_ID POSITION(1), EMP_NAME, EMP_NUMBER, START_DATE DATE "fmDD/MM/RRRR" )
    begindata
    1,A,11,13/01/2011
    2,B,12,13/01/2011
    3,C,13,13/01/2011
    4,D,14,13/01/2011
    5,D,15,13/01/2011
    {code}
    Now:
    {code}
    SQL> select * from XXCPP_SQL_LOADER_TEST;
    no rows selected
    SQL> host sqlldr scott/tiger control=c:\temp\XXCPP_SQL_LOADER_TEST.CTL log=c:\temp\XXCPP_SQL_LOADER_TEST.LOG
    SQL> select * from XXCPP_SQL_LOADER_TEST;
    PERSON_ID EMP_NAME   EMP_NUMBER START_DAT
             1 A                  11 13-JAN-11
             2 B                  12 13-JAN-11
             3 C                  13 13-JAN-11
    SQL>
    {code}
    SY.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Define a Standalone Download Integrator with an Additional Where clause - SQL error

    Hi,
    I am trying to create a standalone integrator with an Additional Where clause. Followed the steps mentioned in the metalink note 360105.1. When I run the integrator, I get the following error message.
    Please resolve the following error to continue.
    SQL error: ORA-00936: missing expression occurred
    processing stored SQL for Content 20007:GENERAL_441_CNT.
    When I look at the log file, here is what I can see:
    10/22/14 10:50 AM AJPRequestHandler-HTTPThreadGroup-15 TRACE          BneHrSQLControl - SQL:SELECT  FROM PER_PEOPLE_V where last_name=$PARAM$.last_name
    10/22/14 10:50 AM AJPRequestHandler-HTTPThreadGroup-15 TRACE          validateSQLStatement value of sqlStatement is: SELECT  FROM PER_PEOPLE_V where last_name=:RSQLP1
    10/22/14 10:50 AM AJPRequestHandler-HTTPThreadGroup-15 DETAIL         BneHrSQLControl.validateSQLStatement() paramName: last_name
    10/22/14 10:50 AM AJPRequestHandler-HTTPThreadGroup-15 DETAIL         BneHrSQLControl.validateSQLStatement() error in SQL: java.sql.SQLSyntaxErrorException: ORA-00936: missing expression
    So, clearly, the SQL statement that is getting built internally is wrong. Ideally, I would expect the statement to be something like this:
    SELECT *  FROM PER_PEOPLE_V where last_name=$PARAM$.last_name.
    RDBMS : 11.2.0.3.0
    Oracle Applications : 12.1.3
    Any pointers towards the resolution of the issue would be of great help.
    Thanks in Advance!
    Lalitha.

    This is a duplicate post of your other question:  create trigger automatic
    DO NOT start duplicate threads for the same question.
    Locking this thread

  • Order in where clause - SQL statement

    Hi,
    The order of the fields in Where clause in OpenSQL statements is important to get the right index?
    Select a b c from t1
    where 
    d = p_d and
    e = p_e
    Or
    Select a b c from t1
    where 
    e = p_e and
    d = p_d
    Index:
    columns e and d.
    Thanks !

    HI,
      Both will give you the same result.. but it is always good to pass the sequence as in the table.. the performance will be good when you follow the sequece of occurance of the fields.
    Thanks
    Mahesh

  • Using SAMPLE with a WHERE clause

    (Oracle 9iR2)
    I am using the SAMPLE keyword in a SELECT statement with a WHERE clause. Is the sample extracted before or after applying the WHERE clause?
    For example, if I have the statement:
    SELECT emp_id FROM employees SAMPLE(10)
    WHERE salary > 50000;
    Does the database first extract a 10% sample of all the rows and then apply the salary filter on the sample (meaning it's possible that no rows are returned even though there are rows with salary > 50000)? Or does it return a 10% sample of the rows that meet the filter condition (meaning rows will always be returned as long as there are rows with salary > 50000)?

    The sample is extracted before the where clause:
    SQL> drop table sample_test;
    Table dropped.
    SQL> create table sample_test (id number, salary number);
    Table created.
    SQL>
    SQL> begin
    2 for i in 1..99 loop
    3 insert into sample_test values (i, 100);
    4 end loop;
    5
    6 insert into sample_test values (100, 1000);
    7 end;
    8 /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> commit;
    Commit complete.
    SQL>
    SQL> select * from sample_test sample(5)
    2 where salary > 100;
    no rows selected

  • Nested IF Statement in WHERE clause...

    Here is a really abridged sample of my package. I need to ensure that if a salesrep has a status of 'I' (for "inactive") that the next salesrep with a status of 'A' (for "active") will be selected in its place.
    Should I include a nested loop within the WHERE clause? Any tips on how I should go about it? I'm a newbie...thanks for the help..
    SELECT rsa.name rep_name
    ,rsa.attribute7 rep_phone
    ,rsa.arrtibute8 rep_ext
    FROM ra_salesreps_all rsa
    WHERE rsa.status(+) = 'A'

    I'm assuming that this is part of your procedure within a package.....
    You must be writing a CURSOR here....
    Cursors are memory locations that can store retrieved rows and then process them one by one.
    create or replace procedure my_proc
    (<example_var> IN|OUT TYPE)
    IS
    cursor my_cursor IS
    select <the fields I want>
    from <sales type table>
    where <my value> = 'A';
    BEGIN
    <how to process the cursor>
    You can write the cursor process 2 ways:
    1) FOR x in <name_of_cursor> LOOP
    (This does whatever to the data for every record already selected by the cursor)
    2) OPEN....FETCH....CLOSE
    This is only scratching the surface of cursors...you need to read about these for what you are doing.
    Question though...is this something you need to run for a SQL process in Oracle Applications??....if so you don't need to write a package/ procedure. You can write a cursor and load it as type SQL*PLUS, and it will run for you.
    null

  • Exclude duplicate values on SQL where clause statement

    Hi!
    Are some posibilities to exclude duplicate values do not using sql aggregate functions in main select statement?
    Priview SQL statement
    SELECT * FROM
    select id,hin_id,name,code,valid_date_from,valid_date_to
    from diaries
    QRSLT
    WHERE (hin_id = (SELECT NVL(historic_id,id)FROM tutions where id=/*???*/ 59615))
    AND NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy')) <= (SELECT NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy'))FROM tutions where id= /*???*/ 59615)
    AND trunc(valid_date_from) >=(SELECT trunc(valid_date_from)FROM tutions where id= /*???*/ 59615)
    The result
    ID                  HIN_ID    NAME      CODE    VALID_DATE FROM                 VALID_DATE_TO    
    50512
    59564
    RE TU
    01
    07.06.2013 16:32:15
    07.06.2013 16:33:28
    50513
    59564
    TT2 
    02
    07.06.2013 16:33:23
    07.06.2013 16:33:28
    50515
    59564
    TT2 
    02
    07.06.2013 16:33:28
    07.06.2013 16:34:42
    50516
    59564
    ROD 
    03
    07.06.2013 16:34:37
    07.06.2013 16:34:42
    VALID_DATE_TO & AND VALID_DATE_FROM tutions
    07.06.2013 16:34:42
    15.07.2013 10:33:23
    In this case i got duplicate of entry TT2 id 50513  In main select statement cant use agregate functions are even posible to exclude this value from result modifying only the QLRST WHERE clause (TRUNC need to be here)
    THANKS FOR ANY TIP !
    ID.

    Hi, Ok this is working in this case
    SELECT * FROM
    select id,hin_id,name,code,valid_date_from,valid_date_to
    from diaries ahs
    QRSLT
    WHERE (hin_id = (SELECT NVL(historic_id,id)FROM aip_healthcare_tutions where id=/*???*/ 59615))
    AND NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy')) <= (SELECT NVL(valid_date_to,to_date('22.12.2999','dd.mm.yyyy'))FROM tutions where id= /*???*/ 59615)
    AND trunc(valid_date_from) >=(SELECT trunc(valid_date_from)FROM tutions where id= /*???*/ 59615)
    AND NOT  EXISTS
    (SELECT null FROM diaries ahs WHERE  ahs.valid_date_from < QRSLT.valid_date_from
        AND QRSLT.hin_id=ahs.hin_id
        AND QRSLT.code=ahs.code);
    Result
    50512
    59564
    RE TU
    01
    07.06.2013 16:32:15
    07.06.2013 16:33:28
    50513
    59564
    TT2 
    02
    07.06.2013 16:33:23
    07.06.2013 16:33:28
    50516
    59564
    ROD 
    03
    07.06.2013 16:34:37
    07.06.2013 16:34:42
    But if the Data in tutions row  are theese(valid_date_to-null)  then NO ROWS are returning and its logical because in full result list Valid_date_from column are logical incorect
    valid_date_from                                 valid_date_to
    15.07.2013 10:33:23
    NULL
    ID                  HIN_ID    NAME      CODE    VALID_DATE FROM                 VALID_DATE_TO 
    50510
    59564
    RE TU
    01
    07.06.2013 16:33:28
    50511
    59564
    TT2 
    02
    07.06.2013 16:34:41
    50514
    59564
    ROD 
    03
    07.06.2013 16:34:41
    50520
    59564
    Params
    04
    03.07.2013 21:01:30
    50512
    59564
    RE TU
    01
    07.06.2013 16:32:15
    07.06.2013 16:33:28
    50513
    59564
    TT2 
    02
    07.06.2013 16:33:23
    07.06.2013 16:33:28
    50515
    59564
    TT2 
    02
    07.06.2013 16:33:28
    07.06.2013 16:34:42
    50516
    59564
    ROD 
    03
    07.06.2013 16:34:37
    07.06.2013 16:34:42
    Are that posible modifying where statement  if the valid_date_to in tutions are null then theese records where in diary valid_date_to is null is correct to, but need to stay previos logic
    D                  HIN_ID    NAME      CODE    VALID_DATE FROM                 VALID_DATE_TO 
    50510
    59564
    RE TU
    01
    07.06.2013 16:33:28
    null
    50511
    59564
    TT2 
    02
    07.06.2013 16:34:41
    null
    50514
    59564
    ROD 
    03
    07.06.2013 16:34:41
    null
    50520
    59564
    Params
    04
    03.07.2013 21:01:30
    null
    Thanks !
    ID.

  • SQL Strings in Where Clause - single quotes issue

    All,
    I’m having issues related to SQL String literals when trying to deploy to flash. The complication works fine but I then get a message (see below) stating that a ; is missing. The SQL query and the iview runs fine when we use numeric values or do not apply a where clause on the table.
    I am using Visual Composer that has been packaged with NW2004sSP7_Preview
    VC & Flex Version: 645.7.0.3
    The Error message is get is;
    Error in executing a process for Flex compilation, Error 1033: ';' expected
          (C:usrsapJ2EJC01j2eeclusterserver0GUIMachine_Business_Packagestest_48731FLEX_COMPILATION_FOLEDRAADCN.mxml:269)
    Error 1205: The statement 'Test' is incomplete.
          (C:usrsapJ2EJC01j2eeclusterserver0GUIMachine_Business_Packagestest_48731FLEX_COMPILATION_FOLEDRAADCN.mxml:269)
    Failed to compile AADCN.mxml
    When I goto the deployment file – it has the below line;
    <i>'<Request type="EXECUTE_RELATIONAL" system="BI_JDBC" system_type="SAP_BI_JDBC" maxrows="500" templateid="BIR_SQL"><Objects type="INPUT" shape="OBJ" role="INPUT"><Object type="INPUT_FIELD" id="SQL_STATEMENT" appName="SQL" mapped="0" value=""/></Objects><Objects type="OUTPUT" shape="SET" role="OUTPUT"><Object type="OUTPUT_FIELD" id="name" appName="name"/></Objects><Objects id="1" type="TEMPLATE_PARAMETER"><Object id="2" type="SQL" value="select name from pub.srcompany where name ='Test Company'"/></Objects></Request>';</i>
    It seems that the parser for the flash deployment is prematurely finishing the parse when it hits the single quotation in the SQL string!
    We had a similar error where if we had a carriage return in the SQL (e.g. between the from & the where clause) then the deployment parser was stating that the line finished prematurely. In the deployment file the carriage return forced a new line thus making the message incomplete. Removing the carriage return resolve that issue
    The SQL Preview in the SQL Editor within VC works fine with the string literals in the where clause.
    The functionality compiles & deploys in web dynpro however it does not return the results to the table
    Questions
    1:> Has anyone successfully used flash with string literals in the SQL where clause or had seen this issue in the past?
    2:> Is there a setting to get the SQL working on Web dynpro for the information to be returned that I may have missed?
    Any assistance would be greatly appreciated.
    Best Regards,
    Ian.

    Hey,
    I have worked with SQL Editor a lot. Here's a how to guide I put together on it:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6339e7d4-0a01-0010-1c98-db00e52e989a
    Let me know if that helps...
    Prakash

  • How do I modify the WHERE clause in my SQL query?

    This seems like such a straight-forward part of the report design, but I'm fairly new to Crystal Reports and I only have experience with modifying reports someone else has already written.  In this particular case, I just need to modify the WHERE clause of the SQL query.  I can select Show SQL Query and see what statement is being used to select data, but I can't find where to modify it since it's grayed out.  I see how to change the selection criteria, parameters, grouping, etc...just not the WHERE clause.  The report is linked to a database used for reporting with a table created and populated by a stored procedure.  I don't need to modify the stored procedure because the data I want to filter by is currently in the table--I just don't know how to filter by what I need.  Here's part of the query:
    SELECT "rpt_dist"."startdate", "rpt_dist"."transtype", "rpt_dist"."laborcode", "rpt_dist"."crewid", "rpt_dist"."regularhrs" FROM   "Reporting"."dbo"."rpt_dist" "rpt_dist"
    WHERE  (rpt_dist."transtype" <> 'WORK' AND rpt_dist."transtype" <> 'WMATL') AND rpt_dist."laborcode" LIKE 'S%' AND (rpt_dist."crewid" = 'HOUS' OR rpt_dist."crewid" = 'HOUS2' ...
    I would like to add another crewid to the WHERE clause.  Thanks for any input.

    1.Open the report in the crystal designer
    2.Go to the field explorer(if hidden go to view menu->field explorer)
    3.Rt. click on the database fields->choose database expert
    4.Now you will see 2 columns-Available DataSource  and Selected Tables
    5.Rt. click on the object(ex.command) available in the Selected Tables column->Choose Edit command
    6.A new Modify Command window will appear,here you can edit your SQL Query
    I get to step 4 and I see the two columns including my database and the report table, but there is no command object available.  If I right-click on my table, I can just view the Properties. ??
    As for the other tip to modify the record selection:  I don't see anywhere the other crewid values are set and if I add the one I'm missing, it doesn't modify the existing SQL Query and when I preview the report it throws off the results so that no data displays??
    I'm using Crystal Reports 11.5 if that makes a difference.  Thanks again.

  • How to construct the where clause for a nested xml target file

    Post Author: jlpete72
    CA Forum: Data Integration
    I'm having some problems getting the desired results creating a multi-level nested xml file.  Specifically, it does not seem that the where clause in the child schemas respects values from parent schemas.  I'm sure I'm constructing something incorrectly, but am running out of ideas. 
    I am working with the classic company/order/line hierarchy and there are three levels of output schemas in my target xml file, one for company, order header and order line information.
    For testing, I have hardcoded a restriction at the order header line to deal with only one order.  But unless I hardcode values into the where clause at the order line level of the schema, all values are returned for orders belonging to the company defined in the company level.
    I'm trying a where clause at the order line level similar to:
    order_line.customer = order_header.customer and order_line.order_num = order_header.order_num
    If the customer has more than one order in the data file, then all orders for that customer are placed in the detail for the order header.  Only if I hard code the order number in the where clause do I get only the lines for the order specified in the header section.  Not very practical. 
    What am I missing?

    An External Parsed Entity could be used to reference a schema.
    In your DTD:
    <!ENTITY datamodules SYSTEM "file:///c:/Datamodules/Datamodules.xsd">
    Refer the external entity in xml document:
    <datamodules>&datamodules;</datamodules>

  • Improve the performance in stored procedure using sql server 2008 - esp where clause in very big table - Urgent

    Hi,
    I am looking for inputs in tuning stored procedure using sql server 2008. l am new to performance tuning in sql,plsql and oracle. currently facing issue in stored procedure - need to increase the performance by code optmization/filtering the records using where clause in larger table., the requirement is Stored procedure generate Audit Report which is accessed by approx. 10 Admin Users typically 2-3 times a day by each Admin users.
    It has got CTE ( common table expression ) which is referred 2  time within SP. This CTE is very big and fetches records from several tables without where clause. This causes several records to be fetched from DB and then needed processing. This stored procedure is running in pre prod server which has 6gb of memory and built on virtual server and the same proc ran good in prod server which has 64gb of ram with physical server (40sec). and the execution time in pre prod is 1min 9seconds which needs to be reduced upto 10secs or so will be the solution. and also the exec time differs from time to time. sometimes it is 50sec and sometimes 1min 9seconds..
    Pl provide what is the best option/practise to use where clause to filter the records and tool to be used to tune the procedure like execution plan, sql profiler?? I am using toad for sqlserver 5.7. Here I see execution plan tab available while running the SP. but when i run it throws an error. Pl help and provide inputs.
    Thanks,
    Viji

    You've asked a SQL Server question in an Oracle forum.  I'm expecting that this will get locked momentarily when a moderator drops by.
    Microsoft has its own forums for SQL Server, you'll have more luck over there.  When you do go there, however, you'll almost certainly get more help if you can pare down the problem (or at least better explain what your code is doing).  Very few people want to read hundreds of lines of code, guess what's it's supposed to do, guess what is slow, and then guess at how to improve things.  Posting query plans, the results of profiling, cutting out any code that is unnecessary to the performance problem, etc. will get you much better answers.
    Justin

  • PL/SQL Evaluation problem of where clause in case of  NUMBER column type

    I found the following problem in Oracle® Database 2 Day Developer's Guide 11g Release 1 (11.1) B28843-04:
    The sole parameter of function eval_frequency is employee_id IN employees.employee_id%TYPE.
    An ORA-01422 exception occurs when the execution reaches the following select command
    SELECT e.hire_date
    INTO hire_date
    FROM employees e
    WHERE employee_id= e.employee_id;
    A possible cause of the error is that the type of employee_id is NUMBER while the employees.employee_id is NUMBER(6,0) . The result of the selection is the same as there were no WHERE clause at all.
    Everything worked fine, when I declared a temporary variable of NUMBER(6,0) for storing the actual parameter of function and used this variable in the where clause, but I consider this "solution" as being no solution.
    It is pointless to use %TYPE parameter of a function for flexibility if I must degrade this flexibility by a fixed declaration of a temporary variable of the same type as the column in question.
    What is wrong?
    The Developer'Guide I used, the Oracle Sql Developer I used or the PL/SQL version ?

    Hi,
    Welcome to the forum!
    user8949829 wrote:
    A possible cause of the error is that the type of employee_id is NUMBER while the employees.employee_id is NUMBER(6,0) . The result of the selection is the same as there I don't think so. The variable employee_id is defined as having the exact same type as the eponymous column. Even if it didn't, I believe Oracle will always implicity convert between datatypes when possible, rounding if necessary. That may cause errors, but it isn't causing this error.
    No, the error has nothing to do with the data type. It has to do with the ambiguity of employee_id: is it a column, or is it a variable?
    The default is that it means the column name, so
    WHERE   employee_id = e.employee_idis equivalent to saying
    WHERE   e.employee_id = e.employee_idwhich isn't quite the same thing as not having a WHERE clause; rows with NULL employee_id would still be excluded, if there were any.
    I think it's best not to use variable names that are the same as column names. You could call the variable v_employee_id, or, since it's an IN-argument, in_employee_id.
    If you must use a variable that can be mistaken for a column, then qulaify it with the name of the procedure, like this:
    WHERE   eval_frequency.employee_id = e.employee_id
    Everything worked fine, when I declared a temporary variable of NUMBER(6,0) for storing the actual parameter of function That makes sens. You probably gave that variable a name that couldn't be mistaken for a column in the table.
    Edited by: Frank Kulash on Jan 12, 2011 8:27 PM

  • SQL Query with a little bit more complicated WHERE clause performance issue

    Hello, I have some performance issue in this case:
    Very simplified query:
    SELECT COUNT(*) FROM Items
    WHERE
    ConditionA OR
    ConditionB OR
    ConditionC OR ...
    Simply I have to determine how many Items the user has access through some complicated conditions.
    When there is a large number of records (100,000+) in the Items table and say ~10 complicated conditions concatenated in WHERE clause, I get the result about 2 seconds in my case. The problem is when very few conditions are met, f.e. when I get only
    10 Items from 100,000.
    How can I improve the performace in this "Get my items" case?
    Additional information:
    the query is generated by EF 6.1
    MS SQL 2012 Express
    Here is the main part of the real SQL Execution Plan:

    Can you post table/index DDL?  Query?
    Sample query:
    exec sp_executesql N'SELECT
    [GroupBy1].[A1] AS [C1]
    FROM ( SELECT
    COUNT(1) AS [A1]
    FROM [dbo].[Tickets] AS [Extent1]
    LEFT OUTER JOIN [dbo].[Services] AS [Extent2] ON [Extent1].[ServiceId] = [Extent2].[Id]
    WHERE (@p__linq__0 = 1) OR ([Extent1].[SubmitterKey] = @p__linq__1) OR ([Extent1].[OperatorKey] = @p__linq__2) OR (([Extent1].[OperatorKey] IS NULL) AND (@p__linq__2 IS NULL)) OR ([Extent1].[SolverKey] = @p__linq__3) OR (([Extent1].[SolverKey] IS NULL) AND (@p__linq__3 IS NULL)) OR ([Extent1].[Incident2ndLineSupportKey] = @p__linq__4) OR (([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (@p__linq__4 IS NULL)) OR ((@p__linq__5 = 1) AND ((1 = CAST( [Extent1].[TicketType] AS int)) OR ((@p__linq__6 = 1) AND (((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[IncidentManager] = @p__linq__7) OR (([Extent2].[IncidentManager] IS NULL) AND (@p__linq__7 IS NULL)))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ServiceRequestManager] = @p__linq__8) OR (([Extent2].[ServiceRequestManager] IS NULL) AND (@p__linq__8 IS NULL)))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ProblemManager] = @p__linq__9) OR (([Extent2].[ProblemManager] IS NULL) AND (@p__linq__9 IS NULL)))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ChangeManager] = @p__linq__10) OR (([Extent2].[ChangeManager] IS NULL) AND (@p__linq__10 IS NULL)))))) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceDeputyManagers] AS [Extent3]
    WHERE ([Extent1].[ServiceId] = [Extent3].[ServiceId]) AND ( CAST( [Extent3].[TicketType] AS int) = CAST( [Extent1].[TicketType] AS int)) AND ([Extent3].[UserProviderKey] = @p__linq__11)
    )))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[Incident1stLineSupportLimitedAccess] <> cast(1 as bit))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ServiceRequestLimitedAccess] <> cast(1 as bit))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND ([Extent2].[ProblemLimitedAccess] <> cast(1 as bit))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ChangeLimitedAccess] <> cast(1 as bit))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent4]
    WHERE ([Extent1].[ServiceId] = [Extent4].[ServiceId]) AND (2 = CAST( [Extent4].[TicketType] AS int)) AND ([Extent4].[UserProviderKey] = @p__linq__12) AND (1 = [Extent4].[SupportLine])
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent5]
    WHERE ([Extent5].[UserProviderKey] = @p__linq__13) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent6]
    WHERE ([Extent6].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent6].[TicketType] AS int)) AND (1 = [Extent6].[SupportLine]) AND ([Extent6].[OperatorGroupId] = [Extent5].[OperatorGroupId])
    )))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent1].[IncidentFunctionEscalatedTo2ndLineSupport] = 1) AND ([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (([Extent2].[Incident2ndLineSupportLimitedAccess] <> cast(1 as bit)) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent7]
    WHERE ([Extent1].[ServiceId] = [Extent7].[ServiceId]) AND (2 = CAST( [Extent7].[TicketType] AS int)) AND ([Extent7].[UserProviderKey] = @p__linq__14) AND (2 = [Extent7].[SupportLine])
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent8]
    WHERE ([Extent8].[UserProviderKey] = @p__linq__15) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent9]
    WHERE ([Extent9].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent9].[TicketType] AS int)) AND (2 = [Extent9].[SupportLine]) AND ([Extent9].[OperatorGroupId] = [Extent8].[OperatorGroupId])
    )))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = CAST( [Extent1].[TicketState] AS int)) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent10]
    WHERE ([Extent1].[ServiceId] = [Extent10].[ServiceId]) AND (3 = CAST( [Extent10].[TicketType] AS int)) AND ([Extent10].[UserProviderKey] = @p__linq__16)
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent11]
    WHERE ([Extent11].[UserProviderKey] = @p__linq__17) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent12]
    WHERE ([Extent12].[ServiceId] = [Extent1].[ServiceId]) AND (3 = CAST( [Extent12].[TicketType] AS int)) AND ([Extent12].[OperatorGroupId] = [Extent11].[OperatorGroupId])
    )))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND (( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent13]
    WHERE ([Extent1].[ServiceId] = [Extent13].[ServiceId]) AND (4 = CAST( [Extent13].[TicketType] AS int)) AND ([Extent13].[UserProviderKey] = @p__linq__18)
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent14]
    WHERE ([Extent14].[UserProviderKey] = @p__linq__19) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent15]
    WHERE ([Extent15].[ServiceId] = [Extent1].[ServiceId]) AND (4 = CAST( [Extent15].[TicketType] AS int)) AND ([Extent15].[OperatorGroupId] = [Extent14].[OperatorGroupId])
    )))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperators] AS [Extent16]
    WHERE ([Extent1].[ServiceId] = [Extent16].[ServiceId]) AND (5 = CAST( [Extent16].[TicketType] AS int)) AND ([Extent16].[UserProviderKey] = @p__linq__20)
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[OperatorGroupUsers] AS [Extent17]
    WHERE ([Extent17].[UserProviderKey] = @p__linq__21) AND ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[ServiceOperatorGroups] AS [Extent18]
    WHERE ([Extent18].[ServiceId] = [Extent1].[ServiceId]) AND (5 = CAST( [Extent18].[TicketType] AS int)) AND ([Extent18].[OperatorGroupId] = [Extent17].[OperatorGroupId])
    )))) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM [dbo].[TicketInvitations] AS [Extent19]
    WHERE ([Extent19].[TicketId] = [Extent1].[Id]) AND (([Extent19].[InvitedUserProviderKey] = @p__linq__22) OR (([Extent19].[InvitedUserProviderKey] IS NULL) AND (@p__linq__22 IS NULL)))
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM (SELECT
    [Extent20].[CustomerId] AS [CustomerId]
    FROM [dbo].[CustomerUsers] AS [Extent20]
    WHERE ([Extent20].[UserProviderKey] = @p__linq__23) AND ([Extent20].[CanAccessOthersTickets] = 1)
    INTERSECT
    SELECT
    [Extent21].[CustomerId] AS [CustomerId]
    FROM [dbo].[CustomerUsers] AS [Extent21]
    WHERE [Extent21].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect1]
    )) OR ( EXISTS (SELECT
    1 AS [C1]
    FROM (SELECT
    [Extent22].[InternalGroupId] AS [InternalGroupId]
    FROM [dbo].[InternalGroupUsers] AS [Extent22]
    WHERE ([Extent22].[UserProviderKey] = @p__linq__24) AND ([Extent22].[CanAccessOthersTickets] = 1)
    INTERSECT
    SELECT
    [Extent23].[InternalGroupId] AS [InternalGroupId]
    FROM [dbo].[InternalGroupUsers] AS [Extent23]
    WHERE [Extent23].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect2]
    ) AS [GroupBy1]',N'@p__linq__0 bit,@p__linq__1 varchar(8000),@p__linq__2 varchar(8000),@p__linq__3 varchar(8000),@p__linq__4 varchar(8000),@p__linq__5 bit,@p__linq__6 bit,@p__linq__7 varchar(8000),@p__linq__8 varchar(8000),@p__linq__9 varchar(8000),@p__linq__10 varchar(8000),@p__linq__11 varchar(8000),@p__linq__12 varchar(8000),@p__linq__13 varchar(8000),@p__linq__14 varchar(8000),@p__linq__15 varchar(8000),@p__linq__16 varchar(8000),@p__linq__17 varchar(8000),@p__linq__18 varchar(8000),@p__linq__19 varchar(8000),@p__linq__20 varchar(8000),@p__linq__21 varchar(8000),@p__linq__22 varchar(8000),@p__linq__23 varchar(8000),@p__linq__24 varchar(8000)',@p__linq__0=0,@p__linq__1='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__2='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__3='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__4='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__5=1,@p__linq__6=0,@p__linq__7='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__8='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__9='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__10='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__11='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__12='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__13='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__14='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__15='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__16='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__17='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__18='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__19='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__20='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__21='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__22='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__23='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__24='31555851-b89d-4a15-bb05-5a6fd42f9552'
    Generated DDL for related tables: (indexes are primary on PKs and FKs)
    CREATE TABLE [dbo].[CustomerUsers](
    [UserProviderKey] [varchar](184) NOT NULL,
    [CustomerId] [int] NOT NULL,
    [CanAccessOthersTickets] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.CustomerUsers] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[InternalGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[InternalGroupUsers](
    [UserProviderKey] [varchar](184) NOT NULL,
    [InternalGroupId] [int] NOT NULL,
    [CanAccessOthersTickets] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.InternalGroupUsers] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC,
    [InternalGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[OperatorGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[OperatorGroupUsers](
    [UserProviderKey] [varchar](184) NOT NULL,
    [OperatorGroupId] [int] NOT NULL,
    CONSTRAINT [PK_dbo.OperatorGroupUsers] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC,
    [OperatorGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[ServiceDeputyManagers] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[ServiceDeputyManagers](
    [UserProviderKey] [varchar](184) NOT NULL,
    [ServiceId] [int] NOT NULL,
    [TicketType] [int] NOT NULL,
    CONSTRAINT [PK_dbo.ServiceDeputyManagers] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC,
    [ServiceId] ASC,
    [TicketType] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[ServiceOperatorGroups] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[ServiceOperatorGroups](
    [ServiceId] [int] NOT NULL,
    [OperatorGroupId] [int] NOT NULL,
    [TicketTypeValue] [int] NOT NULL,
    [SupportLine] [int] NOT NULL,
    [TicketType] [int] NOT NULL,
    CONSTRAINT [PK_dbo.ServiceOperatorGroups] PRIMARY KEY CLUSTERED
    [ServiceId] ASC,
    [OperatorGroupId] ASC,
    [TicketTypeValue] ASC,
    [SupportLine] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    /****** Object: Table [dbo].[ServiceOperators] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[ServiceOperators](
    [UserProviderKey] [varchar](184) NOT NULL,
    [ServiceId] [int] NOT NULL,
    [TicketTypeValue] [int] NOT NULL,
    [SupportLine] [int] NOT NULL,
    [TicketType] [int] NOT NULL,
    CONSTRAINT [PK_dbo.ServiceOperators] PRIMARY KEY CLUSTERED
    [UserProviderKey] ASC,
    [ServiceId] ASC,
    [TicketTypeValue] ASC,
    [SupportLine] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[Services] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Services](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [ParentId] [int] NULL,
    [Name] [nvarchar](256) NOT NULL,
    [Description] [nvarchar](max) NULL,
    [Disabled] [bit] NOT NULL,
    [NewTicketLimitedAccess] [bit] NOT NULL,
    [Incident1stLineSupportLimitedAccess] [bit] NOT NULL,
    [Incident2ndLineSupportLimitedAccess] [bit] NOT NULL,
    [ServiceRequestLimitedAccess] [bit] NOT NULL,
    [ProblemLimitedAccess] [bit] NOT NULL,
    [ServiceRequestManager] [varchar](184) NOT NULL,
    [IncidentManager] [varchar](184) NOT NULL,
    [ProblemManager] [varchar](184) NOT NULL,
    [Deleted] [bit] NOT NULL,
    [WfDisableIncidentAssignedState] [bit] NOT NULL,
    [WfDisableIncidentConfirmedState] [bit] NOT NULL,
    [WfDisableIncidentTakeFromQueueAction] [bit] NOT NULL,
    [WfDisableIncidentFinishSolutionAction] [bit] NOT NULL,
    [WfDisableServiceRequestAssignedState] [bit] NOT NULL,
    [WfDisableServiceRequestConfirmedState] [bit] NOT NULL,
    [WfDisableServiceRequestTakeFromQueueAction] [bit] NOT NULL,
    [WfDisableServiceRequestFinishSolutionAction] [bit] NOT NULL,
    [WfDisableServiceRequestPostponeAction] [bit] NOT NULL,
    [ChangeLimitedAccess] [bit] NOT NULL,
    [ChangeManager] [varchar](184) NOT NULL,
    [WfDisableChangeTakeFromQueueAction] [bit] NOT NULL,
    [WfDisableChangeAssignedState] [bit] NOT NULL,
    [WfDisableChangeStartPreparationAction] [bit] NOT NULL,
    [IsDepartment] [bit] NOT NULL,
    [InheritsFromDepartment] [bit] NOT NULL,
    [AllowSelectSolverBySubmitterForIncidents] [bit] NOT NULL,
    [AllowSelectSolverBySubmitterForServiceRequests] [bit] NOT NULL,
    [AllowSelectSolverBySubmitterForProblems] [bit] NOT NULL,
    [AllowSelectSolverBySubmitterForChanges] [bit] NOT NULL,
    [AllowAccessToOtherOperatorsIncidents] [bit] NOT NULL,
    [AllowAccessToOtherOperatorsServiceRequests] [bit] NOT NULL,
    [AllowAccessToOtherOperatorsProblems] [bit] NOT NULL,
    [AllowAccessToOtherOperatorsChanges] [bit] NOT NULL,
    [AllowChangeDeadlineForIncidents] [bit] NOT NULL,
    [AllowChangeDeadlineForServiceRequests] [bit] NOT NULL,
    [AllowChangeDeadlineForProblems] [bit] NOT NULL,
    [AllowChangeDeadlineForChanges] [bit] NOT NULL,
    [AllowSelectPriorityForServiceRequests] [bit] NOT NULL,
    [WfDisableIncidentCompletedState] [bit] NOT NULL,
    [WfDoIncidentCompleteActionBySubmittersMessage] [bit] NOT NULL,
    [WfDisableServiceRequestCompletedState] [bit] NOT NULL,
    [WfDoServiceRequestCompleteActionBySubmittersMessage] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.Services] PRIMARY KEY CLUSTERED
    [Id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[TicketInvitations] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[TicketInvitations](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [TicketId] [int] NOT NULL,
    [InitiatorUserProviderKey] [varchar](184) NULL,
    [InitiatorFullName] [nvarchar](max) NULL,
    [InvitedUserProviderKey] [varchar](184) NULL,
    [InvitedFullName] [nvarchar](max) NULL,
    [Type] [int] NOT NULL,
    [CreatedUTC] [datetime] NOT NULL,
    CONSTRAINT [PK_dbo.TicketInvitations] PRIMARY KEY CLUSTERED
    [Id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Table [dbo].[Tickets] Script Date: 7.5.2014 8:39:38 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    SET ANSI_PADDING ON
    GO
    CREATE TABLE [dbo].[Tickets](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [ParentId] [int] NULL,
    [ServiceId] [int] NULL,
    [ServiceMailboxId] [int] NULL,
    [TicketTypeValue] [int] NOT NULL,
    [TicketTypeIdREF] [int] NOT NULL,
    [SubmitterKey] [varchar](184) NOT NULL,
    [SubmitterFullName] [nvarchar](256) NULL,
    [CustomerId] [int] NULL,
    [SolverKey] [varchar](184) NULL,
    [SolverFullName] [nvarchar](256) NULL,
    [Subject] [nvarchar](max) NULL,
    [CreatedUTC] [datetime] NOT NULL,
    [Archived] [bit] NOT NULL,
    [MarkedAsSolvedUTC] [datetime] NULL,
    [ArchivedUTC] [datetime] NULL,
    [TicketSourceValue] [int] NOT NULL,
    [OperatorKey] [varchar](184) NULL,
    [DeadlineUTC] [datetime] NULL,
    [DeadlineLastNotificatedPercentage] [int] NULL,
    [UrgencyValue] [int] NULL,
    [ImpactValue] [int] NULL,
    [PriorityValue] [int] NULL,
    [TicketStateValue] [int] NOT NULL,
    [IncidentFunctionEscalatedTo2ndLineSupport] [bit] NOT NULL,
    [Incident2ndLineSupportKey] [varchar](184) NULL,
    [Incident2ndLineSupportFullName] [nvarchar](max) NULL,
    [TicketType] [int] NOT NULL,
    [Source] [int] NOT NULL,
    [TicketState] [int] NOT NULL,
    [Urgency] [int] NULL,
    [Impact] [int] NULL,
    [TicketSummaryState] [int] NOT NULL,
    [ResolutionText] [nvarchar](max) NULL,
    [ResolutionModifiedUTC] [datetime] NULL,
    [ResolutionEdited] [bit] NOT NULL,
    [ResolutionUserProviderKey] [varchar](184) NULL,
    [ResolutionFullName] [nvarchar](max) NULL,
    [TicketSubType] [int] NULL,
    [ChangeRiskProbabilityValue] [int] NULL,
    [ChangeImpactValue] [int] NULL,
    [ChangeRiskCategoryValue] [int] NULL,
    [RfcText] [nvarchar](max) NULL,
    [RfcModifiedUTC] [datetime] NULL,
    [RfcEdited] [bit] NOT NULL,
    [RfcUserProviderKey] [varchar](184) NULL,
    [RfcFullName] [nvarchar](max) NULL,
    [ManualDeadline] [bit] NOT NULL,
    [ContactInformation] [nvarchar](256) NULL,
    [Imported] [bit] NOT NULL,
    [ForceClosed] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.Tickets] PRIMARY KEY CLUSTERED
    [Id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    GO
    SET ANSI_PADDING OFF
    GO
    /****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[CustomerUsers]
    [CustomerId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_InternalGroupId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_InternalGroupId] ON [dbo].[InternalGroupUsers]
    [InternalGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[OperatorGroupUsers]
    [OperatorGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceDeputyManagers]
    [ServiceId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[ServiceOperatorGroups]
    [OperatorGroupId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperatorGroups]
    [ServiceId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperators]
    [ServiceId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Services]
    [ParentId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_TicketId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_TicketId] ON [dbo].[TicketInvitations]
    [TicketId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_TicketInvitations_InvitedUserProviderKey_TicketId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE UNIQUE NONCLUSTERED INDEX [IX_TicketInvitations_InvitedUserProviderKey_TicketId] ON [dbo].[TicketInvitations]
    [InvitedUserProviderKey] ASC,
    [TicketId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[Tickets]
    [CustomerId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Tickets]
    [ParentId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[Tickets]
    [ServiceId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_ServiceMailboxId] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_ServiceMailboxId] ON [dbo].[Tickets]
    [ServiceMailboxId] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_SolverFullName] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_SolverFullName] ON [dbo].[Tickets]
    [SolverFullName] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_SolverKey] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_SolverKey] ON [dbo].[Tickets]
    [SolverKey] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_SubmitterFullName] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_SubmitterFullName] ON [dbo].[Tickets]
    [SubmitterFullName] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    SET ANSI_PADDING ON
    GO
    /****** Object: Index [IX_SubmitterKey] Script Date: 7.5.2014 8:39:38 ******/
    CREATE NONCLUSTERED INDEX [IX_SubmitterKey] ON [dbo].[Tickets]
    [SubmitterKey] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    /****** Object: Index [IX_Tickets_TicketType_TicketTypeIdREF] Script Date: 7.5.2014 8:39:38 ******/
    CREATE UNIQUE NONCLUSTERED INDEX [IX_Tickets_TicketType_TicketTypeIdREF] ON [dbo].[Tickets]
    [TicketType] ASC,
    [TicketTypeIdREF] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    GO
    ALTER TABLE [dbo].[CustomerUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
    REFERENCES [dbo].[Customers] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[CustomerUsers] CHECK CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId]
    GO
    ALTER TABLE [dbo].[InternalGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId] FOREIGN KEY([InternalGroupId])
    REFERENCES [dbo].[InternalGroups] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[InternalGroupUsers] CHECK CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId]
    GO
    ALTER TABLE [dbo].[OperatorGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
    REFERENCES [dbo].[OperatorGroups] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[OperatorGroupUsers] CHECK CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId]
    GO
    ALTER TABLE [dbo].[ServiceDeputyManagers] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
    REFERENCES [dbo].[Services] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[ServiceDeputyManagers] CHECK CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId]
    GO
    ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
    REFERENCES [dbo].[OperatorGroups] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId]
    GO
    ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
    REFERENCES [dbo].[Services] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId]
    GO
    ALTER TABLE [dbo].[ServiceOperators] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
    REFERENCES [dbo].[Services] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[ServiceOperators] CHECK CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId]
    GO
    ALTER TABLE [dbo].[Services] WITH CHECK ADD CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId] FOREIGN KEY([ParentId])
    REFERENCES [dbo].[Services] ([Id])
    GO
    ALTER TABLE [dbo].[Services] CHECK CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId]
    GO
    ALTER TABLE [dbo].[TicketInvitations] WITH CHECK ADD CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId] FOREIGN KEY([TicketId])
    REFERENCES [dbo].[Tickets] ([Id])
    ON DELETE CASCADE
    GO
    ALTER TABLE [dbo].[TicketInvitations] CHECK CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId]
    GO
    ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
    REFERENCES [dbo].[Customers] ([Id])
    GO
    ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId]
    GO
    ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId] FOREIGN KEY([ServiceMailboxId])
    REFERENCES [dbo].[ServiceMailboxes] ([Id])
    GO
    ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId]
    GO
    ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
    REFERENCES [dbo].[Services] ([Id])
    GO
    ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId]
    GO
    ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId] FOREIGN KEY([ParentId])
    REFERENCES [dbo].[Tickets] ([Id])
    GO
    ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId]
    GO

  • How to dynamically update columns in a where clause to a SQL query in OSB?

    Hi Gurus,
    I have a requirement where in we need to dynamically update a where clause to a SQL query in OSB(11.1.1.6.0).
    For example:
    If the JCA sql string is "select * from emp where emp_id = 100 and emp_status ='Permanent'" now i want to change this where clause and the new query has to be like "select * from emp where emp_name like 'S%' and emp_dept like 'IT' ". basically we need to change the where clause dynamically.
    We can also use "fn-bea:execute-sql()" in a xquery but I don't want to use this function as creates a new connection.
    I have done some home work and found out --> as per the DOC "http://docs.oracle.com/cd/E23943_01/dev.1111/e15866/jca.htm#OSBDV943" section: "25.5.2 JCA Transport Configuration for Proxy and Business Services", when a business service is created by using JCA, we can see Interaction Spec Properties under JCA Transport Tab. This will have a property "SqlString' and we can over ride it. But I am unable to figure out how to over ride the value. I have tried by using Transport Headers activity but no luck. Please guide me how to achieve this?
    Thanks in advance
    Surya

    I solved my problem.
    In my header renderer, I simply added a line to set the text to the object value "label.setText( (String) value );" (where label is an instance of a JLabel.
    Thank you to who took some time to think about it.
    Marc

  • Clarification on using function in where clause of oracle sql query

    I have an issue in regarding function using where clause of sql query..
    We are facing performance issue while executing query, so in what ways to improve the performance of the query which i have posted below.
    select col ,case when my_function(parameter)
    from tab1 a ,tab2 b,tabl3 c
    where a.column1=b.column2
    and b.column3 =c.column6
    and my_function(parameter)>0
    Regards
    Dinesh
    Edited by: wild fire on May 18, 2012 4:15 PM

    Dinesh,
    remind that when you use a function in the where clause it normally will get started for each record in the table.
    So your answer is two-fold:
    1. make the function only start when needed by adding a function based index on the table (this will make inserts and updates slower)
    2. make the function faster by adding the DETERMINISTIC clause if possible. this will make Oracle "cache" the result of the function.
    Regards,
    Richard
    blog: http://blog.warp11.nl
    twitter: @rhjmartens
    If this question is answered, please mark the thread as closed and assign points where earned..

Maybe you are looking for

  • Infotype 0057 - Invisible fields - Check on amount/number

    Hi guys, I am using the infotype 57 to use the field P0057-MGART only. So in the table V_T588M I have put all the other fields in invisible mode. Anyway, a check is still activated: when I try to save a new record, I have the error message "Enter amo

  • Email setup Application is gone

    I updated my BB Curve and now my email setup application is gone.  i have selected "show all."  so, right now i can't update or verify any of my email accounts.  anyone have a solution?  thanks Solved! Go to Solution.

  • Need Recovery Disks - Please Help!

    Hello, I need the recovery disks for my "Lenovo 3000 N200" laptop as I can not create the disks myself. Problem is, when I tried to call Lenovo for the disks and pressed 2 for the 3000 support, "it didn't recognize my choice". I really need these dis

  • Javadb "table does not exist" Problem

    Hi, I am learning to program jsp's, please help me. I created a new database HelloWorld and a table named Languages in HelloWorld, i used javaDb bundled with Java System Application Server 9, java EE 5 and Netbeans 5.5. When I created it in netbeans,

  • Passing Parameter before execute-query?

    I want to do the following scenario, please I need help so I can do this. On Execute query i want a parameter to be passed. For Example I have a table of employees, and if any user executes query on employees form then before execution of query, form