Racer SQL
Racer SQL

Reputation: 217

What separator to use when sending SQL Query results in .CSV via email?

so I could get this query to do what I need:

EXEC msdb.dbo.sp_send_dbmail
@recipients = '[email protected]',
@profile_name = 'my profiles',
@subject='subject',
@body='body',
@query= 'SELECT top 10 * FROM my table',
@attach_query_result_as_file=1,
@query_result_separator=',', 
@query_attachment_filename = 'test.csv'

even using separator ' ', or ','` I can't make it readable and I can't find what SQL Server uses as a separator. Many queries around have the same result, with a csv attached with unreadeable data.

thank you !

this is what I get:

enter image description here

Upvotes: 1

Views: 46

Answers (0)

Related Questions