Create index in SQL using a variable

Hello, need to programatically create an index in a SQL script using a variable for the tablespace name.
VARIABLE ts_name VARCHAR2(50)
BEGIN
SELECT tablespace_name INTO :ts_name
from user_indexes
where TABLE_NAME = 'PREFERRED_CUSTOMER';
end;
How would I now issue a create index statement like the one below but substituting the tablespace name with the ts_name variable from above?
CREATE UNIQUE INDEX XAK2PREFERRED_CUSTOMER ON FOCUS.PREFERRED_CUSTOMER (PREFERRED_CUST_NUM) TABLESPACE FOCUSPCIX;
Thank you,
David

I am upgrading a customer database to unicode and I need to convert certain columns to NCHAR base. I am using an alter table command to do this. To make it fasted I need to drop indexes and recreate them at the end. Not all of our customers have used the default tablespace naming conventions so rather than having to change the script each time I was hoping to make the tablespace name portion of the create index DDL dynamic. Thank you,
David

Similar Messages

  • Newly created index not being used

    Hello friends,
    I am observing that a newly created index on a z table with mandt & a new field is not being used. I have already rebuild index & updated stats for table.
    when we query on this table with where clause having same 2 fields mandt & other.. we expected this index to be used. This table is very large. What more i can do now ?
    In trace/SQL session, we can see it is going full table scan.. and takes very long time.
    this new field contain no data as of now for all existing rows. Is this the reason ? or sometihng else ?
    SQL Statement
    SELECT
    FROM
      "ABSA"
    WHERE
      "MANDT" = :A0 AND "ZABCD" = :A1
    Execution Plan
    Explain from v$sql_plan not possible ->  Explain from PLAN_TABLE is displayed !
    No values in v$sql_plan for Address: 0000000166710240 Hash_value:  3891403872 Child_number:  0 Sql_id:
    SELECT STATEMENT ( Estimated Costs = 905.739 , Estimated #Rows = 110.190.667 )
            1 TABLE ACCESS FULL ZABSA
              ( Estim. Costs = 905.739 , Estim. #Rows = 110.190.667 )
              Estim. CPU-Costs = 152.614.535.266 Estim. IO-Costs = 899.784
              Filter Predicates
    NONUNIQUE  Index   ZABSA~Z01
    Column Name                     #Distinct
    MANDT                                          1
    ZABCD                                         1
    thanks & regards
    ashish
    Edited by: ashish vikas on Mar 3, 2012 9:05 PM

    ashish vikas wrote:
    > Execution Plan
    > Explain from v$sql_plan not possible ->  Explain from PLAN_TABLE is displayed !
    > No values in v$sql_plan for Address: 0000000166710240 Hash_value:  3891403872 Child_number:  0 Sql_id:
    >
    >  SELECT STATEMENT ( Estimated Costs = 905.739 , Estimated #Rows = 110.190.667 )
    >
    >         1 TABLE ACCESS FULL ZABSA
    >           ( Estim. Costs = 905.739 , Estim. #Rows = 110.190.667 )
    >           Estim. CPU-Costs = 152.614.535.266 Estim. IO-Costs = 899.784
    >           Filter Predicates
    >
    > NONUNIQUE  Index   ZABSA~Z01
    > Column Name                     #Distinct
    > MANDT                                          1
    > ZABCD                                         1
    Hi,
    with this WHERE clause, both columns just one distinct value, the Full Table Scan is indded the best approach, beside
    the point you only need a check to evaluate a value is NOT in the result.
    In this case you should HINT the statement to the new index, because the DB will always assume that this index is non-selective.
    Volker

  • BUG ? :  ADF creating extra VO instance using bind variables in a LOV query

    ADF 11.1.1.1.0
    After "playing around" with bind variables Setting bind variables in view objects for LOV I've come across something strange that I've reproduce using the HR schema and tables Employees and Departments. Its a bit long but here goes :
    Using the HR schema tables departments and employeesI'm trying to create a LOV (selectOneChoice) for the
    employee department, the LOV having a bind variable that limits the values returned in this case returning only DepartmentId = 50
    I've create a VO lovDepartment (not based on an EO) with the following query :
    SELECT Departments.DEPARTMENT_ID,
           Departments.DEPARTMENT_NAME,
           Departments.MANAGER_ID,
           Departments.LOCATION_ID
    FROM DEPARTMENTS Departments
    where DEPARTMENT_ID  = :pDeptIdA LOV has been defined on the DepartmentId attribute of the EmployeesView.
    The lovDepartmentImpl overrides the executeQueryForCollection to set the bind variable value.
        @Override
        protected void executeQueryForCollection(Object object, Object[] object2,
                                                 int i) {
            setNamedWhereClauseParam("pDeptId", "50");       
            super.executeQueryForCollection(object, object2, i);
        }When using an ADF form to create a new employee the DepartmentId lov is empty.
    Enabling SQL tracing shows the following :
    [370] _LOCAL_VIEW_USAGE_model_EmployeesView_lovDepartment1_0 ViewRowSetImpl.doSetWhereClause(-1, pDeptId, null)
    [371] _LOCAL_VIEW_USAGE_model_EmployeesView_lovDepartment1_0 ViewRowSetImpl.execute caused params to be "un"changed
    [372] Column count: 4
    [373] _LOCAL_VIEW_USAGE_model_EmployeesView_lovDepartment1_0 ViewRowSetImpl.doSetWhereClause(-1, pDeptId, null)
    [374] _LOCAL_VIEW_USAGE_model_EmployeesView_lovDepartment1 ViewRowSetImpl.setNamedWhereClauseParam(pDeptId, 50)
    [375] ViewObject: _LOCAL_VIEW_USAGE_model_EmployeesView_lovDepartment1 Created new QUERY statement
    [376] _LOCAL_VIEW_USAGE_model_EmployeesView_lovDepartment1>#q computed SQLStmtBufLen: 235, actual=195, storing=225
    [377] SELECT Departments.DEPARTMENT_ID,
           Departments.DEPARTMENT_NAME,
           Departments.MANAGER_ID,
           Departments.LOCATION_ID
    FROM DEPARTMENTS Departments
    where DEPARTMENT_ID  = :pDeptId
    [378] Bind params for ViewObject: _LOCAL_VIEW_USAGE_model_EmployeesView_lovDepartment1
    [379] For RowSet : _LOCAL_VIEW_USAGE_model_EmployeesView_lovDepartment1_0
    [380] Binding null of type 12 for "pDeptId"
    [381] No Resource Bundle found but null value id:LOV_DepartmentId_LOVUIHints_NullValueId is defined in an ListBinding Definition.It would seem that 2 lovDepartment instances are used one at line 370 LOCALVIEW_USAGE_model_EmployeesView_lovDepartment1_0
    and one at line 374 LOCALVIEW_USAGE_model_EmployeesView_lovDepartment1
    The one at line 374 LOCALVIEW_USAGE_model_EmployeesView_lovDepartment1 gets the variable bound at line 374
    however LOCALVIEW_USAGE_model_EmployeesView_lovDepartment1_0 gets a null value and would explain the empty LOV
    Can anybody explain what is happening here ? (and how to use bind variables in LOV queries)
    Regards
    Paul
    (bump)
    Edited by: Paul (MITsa) on Jul 14, 2009 10:46 AM
    I've now tried all types of LOV from ChoiceList to Radio groupe by testing the application module - none of them work.....
    Edited by: Paul (MITsa) on 14-Jul-2009 22:52

    when you rinvoke executeQueryForCollection the bind variables are allready set and they exist in Object[] object2 method parameters.
    in order to change them you need something like:
    private void changeGenericBindVariable(Object[] params, String paramName, Object paramValue) {
    for (int i = 0; i < params.length; i++) {
    if (paramName.equals(((Object[])params)[0].toString()))
    ((Object[])params[i])[1] = paramValue;
    * executeQueryForCollection - overridden for custom java data source support.
    protected void executeQueryForCollection(Object qc, Object[] params,
    int noUserParams) {
    changeGenericBindVariable(params, "pDeptId", "50")
    super.executeQueryForCollection(object, object2, i);
    But its better to set bind variables before you executeQueryForCollection. like when you invoke LOV.
    For cascading LOVs and the problems i have check:
    [http://adfbugs.blogspot.com/2009/07/jdeveloper-11-r1-cascading-lov-bugs.html]

  • PL SQL using bind variables

    I am very much new to PL/SQL to pardon my neivte.
    I would like to have some PL/SQL code that uses
    bind variables for insert statements and than issue
    commit's after a specific number of inserts.
    For example.
    desc xxx.taba
    a number
    b varchar2(20)
    I want to do someting like this:
    declare
    l_start number default dbms_utility.get_time;
    create or replace procedure insert_xxx(commit in number)
    begin
    for i in 1 .. 1000
    loop
    :a:=i;
    :b:=dbms_random.string('P', 20);
    intert into xxx :a :b;
    if i/mod=(number passed into to proc)
    commit
    end loop;
    dbms_output.put_line
    (round((dbms_utility.get_time-l_start)/100, 2) ||
    ' Seconds...' );
    end;
    end;
    Can somebody help me out with the correct syntax
    as I know it's incorrect.

    A few remarks
    - procedures don't have hidden variables defined in the outside world, as procedures are black boxes, which communicate only with the outside world
    using the actual parameter list
    - procedures don't commit. The caller should always commit!!!
    - procedures don't commit every <n> records. A commit finalizes a logical unit of work, not a technical one.
    If I would have been your supervisor and you would have presented this code, I would have fired you on the spot.
    Committing inside a loop also increases the likelihood of ora-1555 errors.
    So: remove the current parameter
    a and b should be formal parameters of the procedure
    Inside the procedure it should read
    insert into xxx values (a, b)
    Sybrand Bakker
    Senior Oracle DBA

  • Creating Index in Procedure and defined variables

    Hallo,
    I have a procedure and in this I want to create a Index. The table in which I want to create the index in I have defined with a variable.
    The variables I have declared before.
    CREATE OR REPLACE PROCEDURE PROCEDURE_NAME
    IS
    -- variables
    sql_STMT VARCHAR2(4000);
    BEGIN
    -- do something
    SQL_STMT := 'CREATE INDEX XYZ_IX ON &TABLE_XYZ(GEO) INDEXTYPE IS MDSYS.SPATIAL_INDEX';
         EXECUTE IMMEDIATE SQL_STMT;
    END;
    And I get this error message:
    CALL PROCEDURE_NAME()
    FEHLER in Zeile 1:
    ORA-29855: Fehler bei Ausf³hrung der Routine ODCIINDEXCREATE
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in R-tree: [mdrcrtscrt]
    ORA-13231: Index-Tabelle [MDRT_25CEB$] konnte wõhrend Erstellen von R-Baum nicht
    erstellt werden
    ORA-13249: Stmt-Execute Failure: CREATE TABLE MDRT_25CEB$ (NODE_ID NUMBER
    , NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE
    2
    ORA-29400: Data Cartridge-Fehler
    ORA-01031: Nicht ausreichende Berechtigungen
    ORA-06512: in "MDSYS.SDO_INDEX_METHOD_10I", Zeile 10
    ORA-06512: in "STREET_SEGMENT", Zeile 65
    So what is wrong? I can not see the error.
    Kind Regards and thanks

    The user executing this procedure should have explicit create table and create view privileges.
    This is required if the index is created via the procedure even though these explicit privileges are not required
    when the index is created directly in SQL.
    siva

  • Is it NOT possible to create indexes on views using SSMS?

    I'm looking at:
    http://www.mssqltips.com/sqlservertip/1610/sql-server-schema-binding-and-indexed-views/
    The thing is I'm not able to find that index dialogue ANYWHERE. When I google I keep coming up with examples of how to create indexes using TSQL. Is there no way to create an index on an view with SSMS?
    Using SQL Server 2008 R2.

    Expand Views -> expand view -> right click Indexes - > new index

  • ORA-01722: invalid number caused with SQL using bind variable

    Hi,
    Im am hoping that someone can help me resolve a problem thats only just services and is being experienced on quite a few clients.
    our application uses C++ exes and makes OCI calls to the database.
    what has happened in the last week or so, there has been quite a few invalid number errors being received on a prod server but strangly enough we cannot reproduct the error on our UAT system.
    The sql is using bind variables and the information in the trace file shows that a number is being used for the bind variable, here is an extract from one trace file:
    for some schemas, the bind variable value is some currupted value, i think:
    oacdty=01 mxl=32(21) mxlc=00 mal=00 scl=00 pre=00
    oacflg=03 fl2=1206001 frm=01 csi=178 siz=32 off=0
    kxsbbbfp=9a8d62b8 bln=32 avl=03 flg=05
    value="Â*d"
    but on another schema, the value used is:
    Bind#0
    oacdty=01 mxl=32(32) mxlc=00 mal=00 scl=00 pre=00
    oacflg=03 fl2=1206001 frm=01 csi=178 siz=32 off=0
    kxsbbbfp=c5f92718 bln=32 avl=04 flg=05
    value="2101"
    however both produce invalid number errors.
    I am relatively inexperienced as a DBA so would appreciate as much help as i can get.

    Could you post your sql statement that is being run.
    Also post the query plan from your uat system and the one from your production system (They are likely to be different)
    You can export the stats from your production system and run them in your uat system. If you do this, then the execution plans should be the same on both systems(dbms_stats) and if you have the same data you should run into the same problem on uat as in production.
    The root cause of this type of problem is having a column in a table which holds values which are of different datatypes. Typically there is a condition in the where clause which indicates that for example only numeric columns should be retrieved from the column which holds multiple data types. However since the optimizer is free to rewrite the query any way it sees fit, (It does not necessarily execute in the order the sql statement is written) it does not filter this data first, and therefore you hit non-numeric data and run into the invalid number error.
    You can use little techniques like using an inline view with rownum in the column list, to perform the first filter. This ensures that the inline view is executed on its own, rather than being merged (materialized) with the rest of the query.
    A quick temporary solution is to use a comparison like to_char(column_name) = variable
    Make sure your comparisons are correct and it doesn't negatively impact on performance of the query

  • PL/SQL - Using a variable as a table name

    I have a procedure like this -
    PROCEDURE insert_food IS
    BEGIN
    INSERT INTO food_table
    SELECT *
    FROM fruit_table;
    END insert_food;
    So this proceudre would insert all the records in the 'fruit_table' into the 'food_table'.
    Would there be any way to store the 'fruit_table' as a variable and use that in the script?
    Something like -
    PROCEDURE insert_food IS
    table_name varchar(11) := 'fruit_table';
    BEGIN
    INSERT INTO food_table
    SELECT *
    FROM table_name;
    END insert_food;
    Any help would be great!

    create or replace PROCEDURE insert_food IS
    table_name1 varchar(11) := 'emp';
    BEGIN
    execute immediate 'INSERT INTO emp2
    SELECT *
    FROM '||table_name1||'';
    commit;
    END insert_food;then
    exec insert_food;

  • Creating a Hollow Square using on variables

    I have worked up the following code to create a hollow box with asterisks. In it's present form, it is static, not dynamic. Dynamic in the sense that an input box will pop up in which the user will determine the number of sides the hollow box will contain.
    public class Mystery2
    public static void main(String args[])
    int count = 1;
    System.out.println("****");
    while (count <=3 )
    if (count<=2)
    System.out.println("* *");
    else
    System.out.println("****");
    ++count;
    I have spend hours thinking about how modify this code, without any luck. I have tried mulitplying the "*" by the variable (naturally converting the string from the input box to an integer) but, as expected, I get compilation errors-- can't perform an Arithmetic operation between a string and an integer.
    How do I do this little exercise.
    thanks for your help in advance.

    try this it dosn't use any methods so it may be easier to understand
    public static void main(String args[])
       int width;
       int height;
       try
          // get user input
          System.out.println("Enter Width ");
          BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
          width = new Integer(input.readLine()).intValue();
          System.out.println("Enter Height ");
          input = new BufferedReader(new InputStreamReader(System.in));
          height = new Integer(input.readLine()).intValue();
          System.out.println(width +" " + height);
          // print square
          for(int i=0; i<height ; i++)
            if(i==0 || i==height-1)
                // print out top or bottom of square
             for(int j=0; j<width;j++)
                System.out.print("*");
                System.out.println();// new line
         else
            String spaces = new String();
               for(int j=0; j<width -2;j++)
               spaces = spaces + " ";
              // print sides and middle of square
              System.out.println("*" + spaces + "*");
      }catch(Exception e){}

  • How to Update the Date in PL/SQL using a variable?

    Hi,
    I am setting up a varchar of an update statement and would like to put a date variable for the value. It works when I just put SYSDATE in the statement, yet doesn't when I put the date variable. Gives me an ORA-0904 error. Thanks.
    DECLARE
    v_upd VARCHAR2(32767); -- update statement
    l_date varchar(20);
    BEGIN
    select sysdate into l_date from dual;
    v_upd := 'UPDATE table_name SET LAST_MODIFIED_DATE = ' ||
    l_date ;
    v_upd := v_upd || ' where xyz =''123'' ';
    EXECUTE IMMEDIATE v_upd;
    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK;
    RAISE;
    END;

    And you don't need to select sysdate from dual.
    SQL> begin
      2     UPDATE table_name
      3     SET    LAST_MODIFIED_DATE = sysdate
      4     where  xyz = '123';
      5
      6     dbms_output.put_line(sql%rowcount || ' rows updated.');
      7  end;
      8  /
    55103 rows updated.
    PL/SQL procedure successfully completed.

  • How to create index on a xmltype column stored as CLOB

    actually i have two problems.
    i uploaded this schemaA.xsd file into xmldb repository without problems. registration also went ok.
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    schemaURL => 'http://xmlns.example.com/xdb/documentation/schemaA.xsd'
    ,schemaDoc => sys.UriFactory.getUri('/home/dev/schemaA.xsd')
    ,local => TRUE
    ,genBean => false
    ,genTypes => TRUE
    ,genTables => false
    ,enableHierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    END;
    then i run this:
    create table pf_table_a(
         id VARCHAR2(100) primary key,
         xsd VARCHAR2(3000),
    xml_document XMLType
    ) XMLTYPE COLUMN xml_document
    STORE AS CLOB
    XMLSCHEMA "http://xmlns.example.com/xdb/documentation/schemaA.xsd"
    ELEMENT "order";
    and got this error:
    SQL> @d:\usr\dev\perftest\create_tables.sql
    Table created.
    create table pf_table_a(
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    anyway the table was created. so i went on to create indexes.
    SQL> create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@or
    derNo'));
    create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@orderNo
    ERROR at line 1:
    ORA-04063: table "BAUSER1.PF_TABLE_A" has errors
    this of course is wrong. because the command is for creating index of a XMLTYPE table. no a column. but what is the correct command? thanks.
    jack.

    actually i have two problems.
    i uploaded this schemaA.xsd file into xmldb repository without problems. registration also went ok.
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    schemaURL => 'http://xmlns.example.com/xdb/documentation/schemaA.xsd'
    ,schemaDoc => sys.UriFactory.getUri('/home/dev/schemaA.xsd')
    ,local => TRUE
    ,genBean => false
    ,genTypes => TRUE
    ,genTables => false
    ,enableHierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    END;
    then i run this:
    create table pf_table_a(
         id VARCHAR2(100) primary key,
         xsd VARCHAR2(3000),
    xml_document XMLType
    ) XMLTYPE COLUMN xml_document
    STORE AS CLOB
    XMLSCHEMA "http://xmlns.example.com/xdb/documentation/schemaA.xsd"
    ELEMENT "order";
    and got this error:
    SQL> @d:\usr\dev\perftest\create_tables.sql
    Table created.
    create table pf_table_a(
    ERROR at line 1:
    ORA-00955: name is already used by an existing object
    anyway the table was created. so i went on to create indexes.
    SQL> create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@or
    derNo'));
    create index pf_a_index on pf_table_a(extractValue(OBJECT_VALUE, '/order@orderNo
    ERROR at line 1:
    ORA-04063: table "BAUSER1.PF_TABLE_A" has errors
    this of course is wrong. because the command is for creating index of a XMLTYPE table. no a column. but what is the correct command? thanks.
    jack.

  • Does Oracle E-business suite R12 use bind variables?

    Hello,
    We have Oracle E-business suite R12 and database 10.2.0.3.
    I was just wondering does E-business suite R12 use bind variables?
    We have recently purchased Toad and Spotlight, in Spotlight we keep getting an alarm raised for Parse SQL requests (Library cache latches alert) When I've researched into this the recommendation is to try to improve the use of bind variables within your application.
    Please could someone help me answer this?
    Thank you
    Sarah

    Hi,
    I was just wondering does E-business suite R12 use bind variables? Yes it uses bind variables. You can trace a concurrent program and get the tkprof to check it.
    We have recently purchased Toad and Spotlight, in Spotlight we keep getting an alarm raised for Parse SQL requests (Library cache latches alert) When I've researched into this the recommendation is to try to improve the use of bind variables within your application.You can not make every conc. program or sql use bind variables. Some times it is not possible so.
    Thanks

  • Creating dynamic variants to use them in shceduling a report

    Hi Guys,
    We have a program say (P1) to generate IDocs. I have to develop a new program (P2) which will schedule P1 in background. P1 and P2 are having some common selection screen fields along with the other fileds which are uncommon. Now I have to pass the common selection screen fields from P2 to P1 with the help of a variant in order to schedule P1 in background.  In addition to selection screen fields of P1, I have to pass another field (char 1) from a table which is a part of selection screen of P1 and this field does not present in P2.
    Note: All the selection screen fields may be initial both in P1 and P2 programs.
    Can any one suggest me how solve this.
    Thanks in advance.
    Vijay.

    You can create variables in TVARVC table for the common fields. Before submitting P2 from P1 populate these variables. In P2 create a variant which uses these variables from TVARVC table.
    Hope this helps.
    Reward points for all helpful answers.
    Thanks,
    Balaji

  • Using Captivate variables

    I have just created a course that uses Captivate Variables, after I publish a course and go through the slides for a split second at the start of the slide the captivate variables text changes from the Captivate field name to the actual variable. Is there anyway to stop this happening?

    Hi there
    Indeed there are a couple of different ways.
    The simplest is to ensure that AS3 is your ActionScript setting. Click Edit > Preferences > Project > Publish Settings for that.
    More complex is by masking it. Basically you insert something to cover it momentarily. An Image or Highlight Box usually works. Then you adjust the timing and placement accordingly.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • SQL Query using a Variable in Data Flow Task

    I have a Data Flow task that I created. THe source query is in this file "LPSreason.sql" and is stored in a shared drive such as
    \\servername\scripts\LPSreason.sql
    How can I use this .sql file as a SOURCE in my Data Flow task? I guess I can use SQL Command as Access Mode. But not sure how to do that?

    Hi Desigal59,
    You can use a Flat File Source adapter to get the query statement from the .sql file. When creating the Flat File Connection Manager, set the Row delimiter to a character that won’t be in the SQL statement such as “Vertical Bar {|}”. In this way, the Flat
    File Source outputs only one row with one column. If necessary, you can set the data type of the column from DT_STR to DT_TEXT so that the Flat File Source can handle SQL statement which has more than 8000 characters.
    After that, connect the Flat File Source to a Recordset Destination, so that we store the column to a SSIS object variable (supposing the variable name is varQuery).
    In the Control Flow, we can use one of the following two methods to pass the value of the Object type variable varQuery to a String type variable QueryStr which can be used in an OLE DB Source directly.
    Method 1: via Script Task
    Add a Script Task under the Data Flow Task and connect them.
    Add User::varQuery as ReadOnlyVariables, User::QueryStr as ReadWriteVariables
    Edit the script as follows:
    public void Main()
    // TODO: Add your code here
    System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter();
    DataTable dt = new DataTable();
    da.Fill(dt, Dts.Variables["User::varQuery"].Value);
    Dts.Variables["QueryStr2"].Value = dt.Rows[0].ItemArray[0];
    Dts.TaskResult = (int)ScriptResults.Success;
    4. Add another Data Folw Task under the Script Task, and join them. In the Data Flow Task, add an OLE DB Source, set its Data access mode to “SQL command from variable”, and select the variable User::QueryStr.
    Method 2: via Foreach Loop Container
    Add a Foreach Loop Container under the Data Flow Task, and join them.
    Set the enumerator of the Foreach Loop Container to Foreach ADO Enumerator, and select the ADO object source variable as User::varQuery.
    In the Variable Mappings tab, map the collection value of the Script Task to User::QueryStr, and Index to 0.
    Inside the Foreach Loop Container, add a Data Flow Task like step 4 in method 1.
    Regards,
    Mike Yin
    TechNet Community Support

Maybe you are looking for

  • Smart Playlists Sync from Itunes

    Hey all, Whenever I connect my iphone 4 to my macbook all of the smart playlists automatically sync to my iphone, even though i have "manage music manually" selected under my iphone settings. Anyone know how i stop these playlsits from syncing to my

  • Trying to share library at a new location without wifi but with lots of gear.

    Hi all, I have just arrived at a beach house for a holiday. I am trying to watch some TV shows (iTunes downloads, stored on my macbook air) on the big screen here. I have the following equipment: Macbook air with TV shows I want to watch (brand new,

  • RG Registers

    Hi All, As we know that there are standard RG registers and excise registers, in xl reporter.  Is it possible to generate the same reports using Query Wizard or genarator. If so what all fields should i consider in the report. Can any one help me out

  • HOw to call desktop icons to my java application

    Hi All, i want to call all desktop icons to my swing appliation pls tell me how to do this, very important for us. bye N.S

  • Why does it crash everyone after a few seconds of playback?

    I try to playback a podcast but the app crashes and goes to the home screen. I hear a good 10-15 seconds then stops. Why is it doing this?