DECLARE @PackageStartTime Varchar(250) SET @PackageStartTime =? IF(SELECT COUNT(*) FROM [dbo].[Table1] WHERE RowCDate >=@PackageStartTime)>0 BEGIN DECLARE @SUB Varchar(250) SET @SUB = 'File Failed'+@@SERVERNAME DECLARE @BODY Varchar(250) SET @BODY = 'File Failed'+@@SERVERNAME EXEC msdb.dbo.sp_send_dbmail @profile_name='default', @recipients='dev@null.com', @subject=@SUB, @body=@BODY, @query= 'SELECT DISTINCT FileLoadName FROM [dbo].[Table1] WHERE RowCDate >=@PackageStartTime', @attach_query_result_as_file=1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)