Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Help with Sql Query parameters please (copying Access data to Sql Server) Expand / Collapse
Author
Message
Posted Thursday, May 13, 2010 7:47 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 20, 2010 10:56 AM
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
Post #921265
Posted Thursday, June 17, 2010 10:37 PM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, November 11, 2013 8:10 PM
Points: 73, Visits: 183
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
Post #939346
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse