Hi,
We do have an daily indexreorganise task done and we have an email sent on completion to selected users.
Now for some days now we are not receiving emails from the SQL server agent job. However other maintenance plans configured on the same server are working fine, mean they send emails well
this is the code
------------------------------------------------------------------------------------
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'ABC’,
@recipients = 'CENSYSGSCAPP@xxx.com;Team@xx.com;xxxx@sss.com;xxx@sss.com;xxx@aa.com',
@subject = 'Daily index reorganization process is finished on DB Pord Server',
@body = 'Please check the output of the index rebuild process as follows: ',
@query = 'EXEC ABC.dbo.IndexOptimize @Databases = ''ABC'',
@FragmentationHigh_LOB = ''NOTHING'',
@FragmentationHigh_NonLOB = ''NOTHING'',
@FragmentationMedium_LOB = ''INDEX_REORGANIZE'',
@FragmentationMedium_NonLOB = ''INDEX_REORGANIZE'',
@FragmentationLow_LOB = ''NOTHING'',
@FragmentationLow_NonLOB = ''NOTHING'',
@FragmentationLevel1 = 5,
@FragmentationLevel2 = 30,
@PageCountLevel = 1000',
@attach_query_result_as_file = 0
--------------------------------------------------------------------------------------------------------------------------
Now the error comes as :
Already ensured that the service account domain\goodwork is present under SQL security logins with Admin previlige
Went through the below link of MSDN
https://connect.microsoft.com/SQLServer/feedback/details/361954/sp-send-dbmail-fails-when-query-parameter-and-ole-automation-is-used-in-same-batch
But am not able to find what exactly i am to do, can someone help me out.
Should i change any part of this T-SQL above. IF so can some one help me
BR
Eben