|
I have staging table that are auto created when a new file is received. Now I need to create a table based on that staging table if it does not exist and load data.
(comments are locked)
|
Is that what you mean? Thanks Magnus... I was trying something like that but I cant pass an error. My staging table comes from a variable and also the database table. Like my script task creates a staging table and outputs two variables TableName (Database Table name) and StagingTable (Staging Table Name) I used a sql task and used your code. IF OBJECT_ID('@TableName') IS NULL SELECT * FROM @StagingTable INTO @TableName WHERE 1=0 And it gives the following error: SSIS package "Package3.dtsx" starting. Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "IF OBJECT_ID('@TableName') IS NULL SELECT * FROM..." failed with the following error: "Incorrect syntax near the keyword 'INTO'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. Task failed: Execute SQL Task SSIS package "Package3.dtsx" finished: Success. The program '[5804] Package3.dtsx: DTS' has exited with code 0 (0x0). I know that i cannot use variables like this but can u suggest how can used them for creating the table. Thanks
Aug 27 '12 at 09:12 PM
hope
slightly modify the query IF OBJECT_ID('dbo.TestTable') IS NULL SELECT * INTO dbo.TestTable FROM dbo.MainTable WHERE 1=0
Aug 31 '12 at 02:01 PM
yogirk
(comments are locked)
|

