dbTalk Databases Forums  

SSIS package variable type problem

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss SSIS package variable type problem in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
paul
 
Posts: n/a

Default SSIS package variable type problem - 01-05-2006 , 07:12 AM






hello

i am trying to assign a value from a "recordset destination" column to a
package variable with a ForEach Loop.
The recordset column type is [DT_I8], based on an SQL Server query column
which is a bigint type (DENSE_RANK() function return value)
The package variable type is Int64 and the error I receive when I run the
package is :
Error: ForEach Variable Mapping number 1 to variable "User::rank" cannot be
applied.
Error: The type of the value being assigned to variable "User::rank" differs
from the current variable type. Variables may not change type during
execution. Variable types are strict, except for variables of type Object.

I tried using the Object type for the package variable and it works for a
small amount of records, but I am using a "script task" inside the ForEach
Loop, and when the Loop gets to 30000 records, Visual Studio exits with a
fatal application error.
I think the type mapping is correct bigint = [DT_I8] = int64, so what could
be the error cause ?

thanks



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: SSIS package variable type problem - 01-05-2006 , 03:16 PM






Hello Paul,

I have seen a number of people having problems with the Int64 datatype and
have just tested and the same logic works if the variable and column are
Int32 but fail when Int64. Personally I would do a convert to a string in
the assignment query and then have a variable of type string. You could
then convert the variable after the event

Here is what I did in a script task to a string variable which was the assigned
to variable in the ForEach loop (i64 is a string)

Public Sub Main()

Windows.Forms.MessageBox.Show(Dts.Variables("i64") .Value.ToString())


Dim i As Int64 = Convert.ToInt64(Dts.Variables("i64").Value)


Windows.Forms.MessageBox.Show(i.ToString())


Dts.TaskResult = Dts.Results.Success
End Sub


Allan





Quote:
hello

i am trying to assign a value from a "recordset destination" column to
a
package variable with a ForEach Loop.
The recordset column type is [DT_I8], based on an SQL Server query
column
which is a bigint type (DENSE_RANK() function return value)
The package variable type is Int64 and the error I receive when I run
the
package is :
Error: ForEach Variable Mapping number 1 to variable "User::rank"
cannot be
applied.
Error: The type of the value being assigned to variable "User::rank"
differs
from the current variable type. Variables may not change type during
execution. Variable types are strict, except for variables of type
Object.
I tried using the Object type for the package variable and it works
for a
small amount of records, but I am using a "script task" inside the
ForEach
Loop, and when the Loop gets to 30000 records, Visual Studio exits
with a
fatal application error.
I think the type mapping is correct bigint = [DT_I8] = int64, so what
could
be the error cause ?
thanks




Reply With Quote
  #3  
Old   
paul
 
Posts: n/a

Default Re: SSIS package variable type problem - 01-09-2006 , 03:05 PM



thanks for your answer,
i'll give it a try.
regards


"Allan Mitchell" wrote:

Quote:
Hello Paul,

I have seen a number of people having problems with the Int64 datatype and
have just tested and the same logic works if the variable and column are
Int32 but fail when Int64. Personally I would do a convert to a string in
the assignment query and then have a variable of type string. You could
then convert the variable after the event

Here is what I did in a script task to a string variable which was the assigned
to variable in the ForEach loop (i64 is a string)

Public Sub Main()

Windows.Forms.MessageBox.Show(Dts.Variables("i64") .Value.ToString())


Dim i As Int64 = Convert.ToInt64(Dts.Variables("i64").Value)


Windows.Forms.MessageBox.Show(i.ToString())


Dts.TaskResult = Dts.Results.Success
End Sub


Allan





hello

i am trying to assign a value from a "recordset destination" column to
a
package variable with a ForEach Loop.
The recordset column type is [DT_I8], based on an SQL Server query
column
which is a bigint type (DENSE_RANK() function return value)
The package variable type is Int64 and the error I receive when I run
the
package is :
Error: ForEach Variable Mapping number 1 to variable "User::rank"
cannot be
applied.
Error: The type of the value being assigned to variable "User::rank"
differs
from the current variable type. Variables may not change type during
execution. Variable types are strict, except for variables of type
Object.
I tried using the Object type for the package variable and it works
for a
small amount of records, but I am using a "script task" inside the
ForEach
Loop, and when the Loop gets to 30000 records, Visual Studio exits
with a
fatal application error.
I think the type mapping is correct bigint = [DT_I8] = int64, so what
could
be the error cause ?
thanks





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.