binaryman101
asked on
Simple Export SQL 2005 View to a email CSV file
I have a SQL script that I would like to send the file in CSV instead of TXT I have attached the following code. Am asking it to do something that it can not do?
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'U4 Notifications.com'
,@recipients = 'test@test.com'
,@subject = 'Circuits missing a CLLI Code - Process Z4026 - "Garbage man cometh"'
,@attach_query_result_as_file = 1
-- can go to 32767 for query width
,@query_result_width = 32767
,@body_format = 'TEXT'
,@body = 'blah blah blah test message
'
,@append_query_error = 0
,@exclude_query_output = 0
,@query_no_truncate = 0
,@query = 'SELECT ANI = Left(ANI,12) FROM [Billing Automation Processes].dbo.[Z4026 - Circuits missing CO information]'
ASKER
I am a newbie to this, can you offer a little more step by step instructions?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Worked great! Thanks.
but, you can select a wide varchar line and make each line of the CSV yourselves.
Something like select convert(varchar(10),attrib
write it to a file and give it an explicit filename like @query_attachment_filename