SQL integration Services Data Type Issue

In an Execute SQL Task control Flow I am using the Single Row Result Set. SQL Query follows: Select Count(*) As Rec_Ct, Sum(Value) As Tot_Val From Sales_Table. The Rec_Ct field is assigned to the RecordCount(int32) variable and the Tot_Val(numeric(16,5) is assigned to the TotalValue(double) variable. Upon execution I receive the error "The type of the value being assigned to variable TotalValue differs from the current type". I have run this package without the Sum(Value) field and the package runs fine. Is it possible to use the SUM aggregate in Integration Services ? Is there another variable type I should be using ? Thanks.
StampITAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DcpKingCommented:
The definition of the sum() function (here) indicates that for a decimal parameter it returns decimal(38, s).

Therefore, looking at the definitions of SSIS data types (here) I would suggest that you use either DT_NUMERIC or DT_DECIMAL. DT_NUMERIC is the larger and so may be necessary for you.

hth

Mike
0
StampITAuthor Commented:
When configuring a variable neither DT_DECIMAL nor DT_NUMERIC are options under Data Type. Boolean, Byte, Char, Dattime,Dbnull,Double,Int16, Int32, Int64, Object, SByte, Single, String, UInt32, and Uint64 are the options. I have tried Double and Single. Tried to convert into varchar and use Char for the variable. None of this worked. Thanks.
0
DcpKingCommented:
You missed the Decimal - it's the one above the Double. .........
Oh! oops! I'm very sorry! I just noticed that your message is tagged SQL Server 2008.

Please use an Object until you get SQL Server 2012, when Decimal is introduced. There's a translation map here that you may find useful.

Again, my apologies!

Mike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

StampITAuthor Commented:
Thanks.
0
DcpKingCommented:
Presumably that helped! Good.
0
StampITAuthor Commented:
Yes. Using the Object data type for the variable allowed storage of the query result. Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.