The type of the value assigned to the variable "User :: de_sters" is different from the current type of the variable

I have a variable de_sters, the variable type string, as defined in my SSIS package, its scope - is the SSIS package, which I needed fillto value a few lines from one table Execute Sql Task.

The bottom line is that I have the Execute Sql Task package, in the properties -> "Sql Statement", which I wrote:

declare @s varchar(max) = '' 
select @s =  case when @s <> '' 
                  then  @s + ',''' + employer_name + '''' 
                  else   @s + '''' + employer_name+ ''''
                  end 
from employers
select @s as Result

Then in Result SetI selected Single Row(first I ran my selection and I saw that it returns only one row). Then on the tab Result Set(left) I wrote in the field Result Name Result(an alias from my previous sql statement) and Variable Namewrote in the file User::de_sters.

But when I run the sql task, it gives me

The type of the value being assigned to variable "User::de_sters"
differs from the current variable type" error.

?

+5
2

, SSIS varchar(max) . limit. max 8000.

declare @s varchar(8000) = '' 

, FullResultSet varchar(max) , object.

, Script task Script component ( ) , object

OleDbDataAdapter oleDA = new OleDbDataAdapter();
DataTable dt = new DataTable();
oleDA.Fill(dt, Dts.Variables["User::YourVariable"].Value);
 foreach (DataRow rowLoop in dt.Rows)
     {
        MessageBox.Show (rowLoop[0].ToString());
     }
+5

varchar(max) SQL Script Tasks Control flow , , . varchar(4000) object, foreach loop container, string,

, :

CREATE PROCEDURE SSIS_VarcharMax_Loader 
     @Input varchar(max) ,
     @maxRowLength int = 50
 AS
 BEGIN
 SET NOCOUNT ON


 ;WITH 
     tmp(inp,c,rn) as (
              select @Input,SUBSTRING(@Input, 1,@maxRowLength),@maxRowLength
           union all
              select @Input,SUBSTRING(@Input,rn,@maxRowLength),rn + @maxRowLength
              from tmp
              where rn < len(@Input)
        )
      select c from tmp
      OPTION (MAXRECURSION 500);

 END;

, foreach , ,

@strResult = (ISNULL(@[User::strResult])?"": @[User::strResult] )+  @[User::str]

asdasdasdasdasd

0

All Articles