Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Create DTS Variable of BIGINT type

Author  Topic 

lnt_sql
Starting Member

6 Posts

Posted - 2010-07-15 : 02:06:18
How do I change the datatype of a variable of DTS.variable class?
I am getting it as Int32 by default.
Variable MaxPrimaryKey = pkg.Variables.Add("MaxPrimaryKey", false, "User", 0);

Currently, the MaxPrimaryKey variable is Int32.
But the schema had to be recently changed to BIGINT.
So, I require the variable to be of type Int64.
I couldn't find much info in the net on how to convert type of such a variable in .NET code.

I have around 300 SSIS packages which were developed using our own custom built application that built the packages using Dts classes in .Net and loading tasks with xml tags.

I also took out the Dtsvariable tag from the dtsx file so created in xml format. Can I just load the same into the package object with a modified type to get it done? If so, where will I generate the DTSID value from, which seems to be auto-generated?
Here is that snippet:
<DTS:Variable><DTS:Property DTS:Name="Expression"></DTS:Property><DTS:Property DTS:Name="EvaluateAsExpression">0</DTS:Property><DTS:Property DTS:Name="Namespace">User</DTS:Property><DTS:Property DTS:Name="ReadOnly">0</DTS:Property><DTS:Property DTS:Name="RaiseChangedEvent">0</DTS:Property><DTS:VariableValue DTS:DataType="3">0</DTS:VariableValue><DTS:Property DTS:Name="ObjectName">MaxPrimaryKey</DTS:Property><DTS:Property DTS:Name="DTSID">{EBD37D38-7880-4740-8064-1A36A9F81027}</DTS:Property><DTS:Property DTS:Name="Description"></DTS:Property><DTS:Property DTS:Name="CreationName"></DTS:Property></DTS:Variable>


Please help me out on this.

lnt_sql
Starting Member

6 Posts

Posted - 2010-07-21 : 11:22:45
This problem has been solved by passing Convert.ToInt64(0) as last parameter to the function pkg.Variables.Add().
Go to Top of Page
   

- Advertisement -