May 26, 2009 at 8:11 am
Hi all, i have a sql task in SSIS. It's very simple i think but i can't get it to work. The SQL Task does this:
select count(*) from tbl1.
Simple right, output in my case is 20. Settings:
ResultSet -> Single Row
ConnectionType - OLE DB
On Result Set:
Result name -> 0
Variable Name -> User::NumberOfRecords
Datatype of variable User::NumberOfRecords is string. It must be a string because the next step is to email this variable. If it is int32, it passes this step, but unable to email.
The error i get is this one (with datatype = string):
An error occurred while assigning a value to variable "NumberOfRecords": "The type of the value being assigned to variable "User:NumberOfRecords" differs from the current variable type. Variables may not change type during execution. Variable types are strict except for values of type object".
I played a bit with CAST and CONVERT, but probably not in the right manner.
Can you please help me to get the result of the count in a string?!
TIA! 😎
May 26, 2009 at 12:35 pm
Hi,
maybe this post (the last "update" at the end of the page) helps.
http://www.developerdotstar.com/community/node/338
-----------------------
SQL Server Database Copy Tool at Codeplex
May 26, 2009 at 3:05 pm
Select Convert(varchar(10), count(*)) from table
works for me.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
May 29, 2009 at 7:04 am
Yep, that works 😀 Thanks!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply