Help with Sql Query parameters please (copying Access data to Sql Server)

  • Hello,

    I created a Dts package to copy one or both of the tables in an Access database to a Sql server database. I created the connections, created global parameters, and in the Transform data Task properties, I chose "SQL query" and wrote this

    IF ? = 1 -- gvTable1Flag (unsigned int)

    SELECT * INTO ? FROM Access_Table1 -- gvNewTableName1 (string)

    IF ? = 1 -- gvTable2Flag (unsigned int)

    SELECT * INTO ? FROM Access_Table2 -- gvNewTableName2 (string)

    Basically, I want to be able to choose which Access tables to copy to the Sql server database

    and have the source tables copied to destination tables whose names are not constant.

    I am getting an error

    "Invalid Sql statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT' or 'UPDATE'"

    If I remove the If statements, I get the following error

    "The SELECT statement includes a reserved word or an argument name, that is misspelled, or the punctuation is incorrect."

    How can I get this to work?

    Thank you,

    Burak

  • Hi Burak30,

    you cant do that in the way as you are trying..

    I guess you are writing the SQL query in Execute SQL task, this task works on Single connection, where as your query has two connections, source (Access) and destination(SQL Server, i.e ?). use DF task , you will get it.

    Regards

    RB

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply