below is code snippet (which im assuming is the cause of the problem) from a certain stored procedure
as in my case, when i execute this particular stored procedure, SQL Server sends me the email AND with the necessary attachment
however, when i create a Job with "EXEC dbo.SOSOStoredProcedure," though the Job executes successfully, no EMAIL is sent to me.
the funny thing is, when i comment out the following lines
the Job executes successfully with an EMAIL being sent to me
does SQL Server's job CANNOT handle xp_sendmail that returns a RESULT set? or i may be mistaken somewhere...
thanks
Code:
EXEC Master.dbo.xp_sendmail
@dbuse = 'DanoneSSS',
@recipients = 'xxx@yyy.co.jp',
@subject = 'mmm nnn',
@message = @parMessage,
@query = 'SELECT CHECK_JS_CODE, CHECK_TYPE FROM T_CHECK_LOG WHERE CHECK_STATUS = 0 ORDER BY CHECK_ID',
@attachments = 'ResultSet.txt',
@attach_results = TRUE,
@no_header = TRUE,
@separator = '',
@ansi_attachment = TRUE
as in my case, when i execute this particular stored procedure, SQL Server sends me the email AND with the necessary attachment
however, when i create a Job with "EXEC dbo.SOSOStoredProcedure," though the Job executes successfully, no EMAIL is sent to me.
the funny thing is, when i comment out the following lines
Code:
@query = 'SELECT CHECK_JS_CODE, CHECK_TYPE FROM T_CHECK_LOG WHERE CHECK_STATUS = 0 ORDER BY CHECK_ID',
@attachments = 'ResultSet.txt',
@attach_results = TRUE,
@no_header = TRUE,
@separator = '',
@ansi_attachment = TRUE
the Job executes successfully with an EMAIL being sent to me
does SQL Server's job CANNOT handle xp_sendmail that returns a RESULT set? or i may be mistaken somewhere...
thanks