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

Using data flow task to copy tables that get created at run time.

$
0
0

As I said, I want to use a data flow task to copy a table in one server to another. This task will be inside a for each loop. The issue is that, every time, the table name is going to be changed. But the schema remains same. All the tables will be having a single column with same data type. The table will be created in destination too with the same name.

To achieve this, I tried using dynamic SQL. The query was getting parsed successfully but I am getting an error like this:

"The metadata could not be determined because the statement " ... " is using dynamic SQL. Consider using WITH RESULT SETS clause."  When I googled it, all the results were talking about sps. But I am not using any stored procedures in my dynamic SQL.

Here is my query inside the source in data flow task:

declare @ApplicationName nvarchar(MAX)
declare @HostQuery nvarchar(MAX)
set @ApplicationName = ?
set @HostQuery = 'select * from Database.dbo.'+@ApplicationName+'_InputIDs'  ;
EXEC sp_executesql @HostQuery
Any help with this issue?

Viewing all articles
Browse latest Browse all 24688

Trending Articles



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