Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Remove 2nd line in result using sp_send_dbmail

Author  Topic 

zeb
Starting Member

1 Post

Posted - 2015-04-21 : 06:45:27
I am using sp_send_dbmail. In my output, the seccond line is like:

------;----;-------;----

I would like my output without this line. Any ideas?

The code I use is this:

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'VNPSQL email',
@recipients = 'my@email.com',
@query = 'SET NOCOUNT ON;SELECT * FROM NSG.dbo.test',
@subject = 'Test',
@attach_query_result_as_file=1,
@query_attachment_filename = 'Test.csv',
@query_result_header = 1,
@query_result_separator = ';',
@query_result_no_padding = 1


The Output is like this

datoen;navn;adresse;land
------;----;-------;----
2015-02-02;Tom;Tromsø;Norge
2015-01-07;Ray;Somerville;USA
2015-03-08;Deng;Shanghai;Kina
2015-03-17;Elzo;Lisboa;Portugal
2015-01-02;Alejandro;Mexico City;Mexico
2015-02-02;Jostein;Tokyo;Japan
2015-02-06;Johan;Bergen;Norge
2014-12-15;Audun;Roma;Italia


Zeb
   

- Advertisement -