Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
burak30
burak30
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 12
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
PaVeRa22
PaVeRa22
SSC-Enthusiastic
SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)SSC-Enthusiastic (121 reputation)

Group: General Forum Members
Points: 121 Visits: 184
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search