GO sp_CONFIGURE 'Database Mail XPs', 1 GO RECONFIGURE GO USE MSDB GO use msdb go DECLARE @SUB VARCHAR(100) SET @SUB = (SELECT 'Employee Report on '+ replace(convert(NVARCHAR, getdate(), 106), ' ', '/')) EXEC sp_send_dbmail @profile_name='test Profile', @recipients='pandikkl01@gmail.com', @subject=@SUB, @body='Attachment File Sent', @query= ' SELECT * EMPLOYEEMAS; , @query_attachment_filename='test.csv', @attach_query_result_as_file=1, @exclude_query_output=1, @query_result_separator=' ',@query_result_width =32767, @query_result_no_padding=1, @query_result_header =1 go
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)