我想讓SQL Server代理將此郵件作爲電子郵件發送發送結果爲csv文件
我所得到的只是錯誤。它沒有@query參數,但我沒有看到問題。
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'e-automate mail',
@recipients = '[email protected]',
@subject = 'on hold customers',
@body='Customers on Hold in E-automate',
@query = 'SELECT CC.CustomerID AS 'E-auto Number',
CC.TextVal AS 'Autotask Number',
ARC.CustomerName
FROM [CoCopeco].[dbo].[ARCustomerCustomProperties] CC
INNER JOIN [CoCopeco].[dbo].[ARCustomers] ARC ON ARC.CustomerID = CC.CustomerID
WHERE ShAttributeID = '2043'
AND ARC.OnHoldCodeID IS NOT NULL
AND DATALENGTH (CC.TextVal) > 0 ' ,
@attach_query_result_as_file=1,
@query_attachment_filename = 'Results.csv',
@query_result_separator = ','
你得到哪些錯誤?除此之外:我不明白你給這個問題的標題的含義 – Marged