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

SSIS Execute SQL task - The type of the value being assigned to variable differs from the current variable type

$
0
0

Hi

I have one issue that I am trying to insert data from Source DB to destination DB. Here table name should be dynamic.

Insert Into @DTableName
(@Columns)
values

Select  * from @STABLENAME

In Query detination columns names we should provide. So I have taken @columns variable to return column names with cama seperation

Declare @Columns varchar(max)

SET @Columns =(select SUBSTRING(
(SELECT ',' + s.name
FROM (select name from sys.columns
where object_id=(select object_id from sys.tables  where type='u' and name =@DTableName
)) s
FOR XML PATH('')),2,200000) )

While I parse this expression in Execute SQL  SQL Source Staatement expression editor I am getting this Error:

[Execute SQL Task] Error: Executing the query "insert into dbo.Test(@columns  )selec..." failed with the following error:"Must declare the scalar variable "@column".". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

can any one give solution for this....


Ram


Viewing all articles
Browse latest Browse all 24688

Trending Articles



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