Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

insert records into dynamically get table using ssis

$
0
0

I have list of tables in excel. Using this list I want to insert records from source database to destination database with the same tablename.

I tried Excel Source to load into Recordset destination. Using DataViewer, the data is apssing correctly. Then After Recordset destination, I have Foreach loop to insert records for each table from source table to destination table (same table name) and different location (from source datbase to destination database). Within Foreach loop, I have Execute SQL task which has a dynamic

Sql Statement:

insert into [dbo].[@tablename]
 select * from [efi_dot_com].[dbo].[@tablename]

Resultset: Single row

ConnectionType: OLE DB

SQLSourceType: Direct input

Get an error

[Execute SQL Task] Error: Executing the query "insert into [dbo].[@tablename]
 select * from [ef..." failed with the following error: "Invalid object name 'efi_dot_com.dbo.@tablename'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

I created a variable Tablename with object type.

I have not created a variable to hold sql statement. Do I need it? If so woudl you please explain to me?


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>