SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 SSIS: select count(*) results in email, error
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

92 Posts

Posted - 06/24/2014 :  11:03:30  Show Profile  Reply with Quote
Im trying to create a package that runs a script and gets the count of records on a table and then have that emailed to me daily.

however I keep receiving a error about the datatype(shouldn't a COUNT return INT datatype?). My sql task result variable(sg_agt_m1_Count)is set as int32. and then in my email task I'm creating a expression for the 'MessageSource' with the following:

 "Postgres Table Import Quality Assurance Daily Statistics "+ Replace((DT_WSTR,15)(DT_DBDATE) DATEADD( "d", -0, GETDATE())," ","")  + "

CMSForte Load Stats " +  "

" +"        Table   "+"
 CMSForte.dbo.sg_agt_m1 :"  

however I'm receiving the following error:

"The data types "DT_WSTR" and "DT_14" are incompatible for binary operator "+". The operand types could not be implicitly cast into compatible types for the operation.  To perform this operation, one or both operands need to be explicitly cast with a operator.

Attempt to set the result type of binary operation ""Postgres Table Import Quality Assurance Daily Statistics " + REPLACE((DT_WSTR,15)(DT_DBDATE)DATEADD("d",-0,GETDATE())," ",'')+"
CMSForte Load Stats"+"
"+"     Table "+"
CMSForte.dbo.sg_agt_m1 :"+ @[User::sg_agt_m1_Count]" failed with error code 0xC0047080.

Any help would be much appreciated

Edited by - mgreen84 on 06/24/2014 13:01:59

Posting Yak Master

160 Posts

Posted - 07/24/2014 :  13:10:27  Show Profile  Reply with Quote
This is an old post but thought to add what may be generating the error.

Since @[User::sg_agt_m1_Count] is defined as int32, this needs to be converted to string

"Postgres....." + (DT_WSTR, 12)@[User::sg_agt_m1_Count]
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000