Hi experts,
I can't get this to work.
So variable @CountOfFilesCopied is defined as int in package
In the SQL Task, Parameter mapping is set to User::CountOfFilesCopied Input Long @CountOfFilesCopied -1
In this testing.... @CountOfFilesCopied has a value of 2
When I run it as below, I get this error:
Conversion failed when converting the varchar value '?' to data type int.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
If I run it without the quote as Declare @CountOfFilesCopied int = ?;
it fails with "profile name is not valid". (The profile SQLMail is valid, I have confirmed that)
Declare @Body1 varchar(250);
Declare @CountOfFilesCopied int = '?';
Set @Body1 = concat('Nbr of files copied: ', cast(@CountOfFilesCopied As varchar(10)));
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQLMail',
@body = @Body1,
@body_format ='HTML' ,
@recipients = 'Me@Me.com;',
@subject = 'Image Copy Has completed';