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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SP to CSV

Author  Topic 

ranalk
Starting Member

49 Posts

Posted - 2012-04-02 : 11:10:45
Hi,

Please let me know how can I set a stored procedure to sent attachment (csv) within Email.

Thanks.

ranalk
Starting Member

49 Posts

Posted - 2012-04-04 : 04:19:32
Hi,

Anyone can assist here ?

lets say the result of the SP is a table with 3 columns and 100 rows how can I send it by email with CSV attachment.

Thanks in advance.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2012-04-04 : 04:32:07
Either BCP it out to a CSV or create your output to amalgamate all the records with a comma.

select field1 + ',' + field2 + ',' + field3 from table

then use sp_send_dbmail to send that query as attachment.
Go to Top of Page
   

- Advertisement -