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

Dynamic SQL Question

$
0
0

I have an SSIS package that reads in 7 flat files, massages the data, and places the results into a staging table (not a temporary table). Also as part of the SSIS package, I store a variable that contains the name of the table the data should be copied to. I believe I need a dynamic sql query (as part of a SQL Task)  to accomplish this but I can't seem to figure out how to do this. I'm basically trying to:

Insert Into @TableName

Select Col1, Col1, COl3 FROM StagingTable

I seen many examples of dynamic sql but they all seem  to reference variables in the Where clause.  Could someone please point me in the right direction, if this is possible. The @TableName  is actually based on a a particular site and will change each month. For example the table name 201905_Location387, 201905_Location_388, etc.

 Any suggestion would be appreciated, thanks

 

Viewing all articles
Browse latest Browse all 24688

Trending Articles



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