April 8, 2014 at 7:33 am
HI all,
I want to add the result of a Select statement inside a parameter, not too sure how to pull this off, but here it is...
--Declare needed variables
Declare @NoOfApprovals Int
--Get count of approvals
Select @NoOfApprovals =
(
select NoOfApprovalsToClaim
from viewManualApprovalsAwaitingProcess
)
--HELP HERE PLEASE !!!! Add number as parameter into email stored procedure.
DECLARE @rc
EXECUTE @rc = USLO1SQL09.GEUSEmail.dbo.spSaveEmailWithAttachmentAndQueue
,'You Have [@NoOfApprovals] To Claim' -- subject
GO
April 8, 2014 at 7:49 am
Here is one way to do this.
--Declare needed variables
--Declare @NoOfApprovals Int --don't need this
declare @Subject varchar(100) --adjust to meet your actual datatype of the parameter
--Get count of approvals
Select @Subject = 'You Have ' + cast(NoOfApprovalsToClaim as varchar(4)) + ' to Claim'
from viewManualApprovalsAwaitingProcess
--HELP HERE PLEASE !!!! Add number as parameter into email stored procedure.
DECLARE @rc
EXECUTE @rc = USLO1SQL09.GEUSEmail.dbo.spSaveEmailWithAttachmentAndQueue
,@Subject
GO
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 11, 2014 at 2:55 am
That worked, thanks Sean 🙂
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply