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)
 Problem storing decimal value in Execute SQL Task

Author  Topic 

Gopher
Yak Posting Veteran

83 Posts

Posted - 2010-09-01 : 10:26:52
Hi All

I am having a problem storing decimal values in parameters in my SSIS 'Execute SQL Tasks'. Here is the problem:

Task 1

SQL Statement 'select lastloaddate from tuploadcontrol2'

The column lastloade date is a decimal datatype

In my Results Set i have the following set:
ResultName = 0
Variable Name: User::LastLoadDate

In the package Explorer the variable ValueType is set to int64

And when I run this I get the following error:
Error: 0xC002F210 at Get Last Load Date, Execute SQL Task: Executing the query "select lastloaddate from tuploadcontrol2" failed with the following error: "The type of the value being assigned to variable "User::LastLoadDate" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.
". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Get Last Load Date

All i want to do is store this Lastloaddate value as a decimal as I have to compare it against another decimal value later on.

I can do this in SQL 2000 DTS but not sure how to do this in 2005.

If anyone can help that would be great and if you need any further information please let me know.

Thanks

Gopher

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-09-01 : 12:02:57
open the execute sql task, go to the parameter mapping tab. under data type, just click it and change it to decimal
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-09-01 : 12:31:52
try giving resultname as lastloaddate


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Gopher
Yak Posting Veteran

83 Posts

Posted - 2010-09-02 : 03:41:20
quote:
Originally posted by russell

open the execute sql task, go to the parameter mapping tab. under data type, just click it and change it to decimal



I have tried this and still get the same error - have tried setting LastLoadDate as an output parameter.
Go to Top of Page

Gopher
Yak Posting Veteran

83 Posts

Posted - 2010-09-02 : 03:47:49
quote:
Originally posted by visakh16

try giving resultname as lastloaddate


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/





Still no joy - same error!

However, I have managed to get round this problem but have unfortunately created a new one.

To sort out the lastloaddate all I do is change the statement and cast it to a varchar.
e.g. select CAST(lastloaddate as varchar(40)) from tuploadcontrol2
this appears to work for all the stages apart from the final task which is updating 'lastloaddate' to its new value. As I have changed it to a varchar I cannot seem to cast it back to a decimal!

Solved one problem and now gained another.

However I did fine this article which seems interesting:
https://connect.microsoft.com/SQLServer/feedback/details/126375/double-variable-datatype-is-limiting?wa=wsignin1.0
Go to Top of Page

Gopher
Yak Posting Veteran

83 Posts

Posted - 2010-09-02 : 04:42:06
Ah, now managed to fix the final error, converting back to a decimal:

update tuploadcontrol2 set lastloaddate = convert(decimal(18,0),convert(decimal(18,0),?) + 1)

Thanks for your help
Go to Top of Page
   

- Advertisement -