I am trying to put a variable into my @query and It errors out by saying I need to declare it. Here is what I am using:
SET NOCOUNT ON
EXEC Training_Records.dbo.qryExpEmpCerts @company
IF @@ROWCOUNT > 0
DECLARE @body VARCHAR(200)
DECLARE @strSQL VARCHAR(200)
SET @body = 'Below is a list of Employees from ' + @company + 'whom have expiring certifications:'
SET @strSQL = 'EXEC Training_Records.dbo.qryExpEmpCerts ' + @company
@width = 120,
@query = @strSQL,
@message = @body,
@subject = 'List of Employees whom have certifications expiring soon'
I have tried all diffrent ways but can't seem to get it right. Thanks in advance