Monday, March 26, 2012

How to use t-sql to email and attachment

I am new to sql and want to write a stored procedure to email a database group an attachment of a report that was created. Can someone please point me in the write direction thanks.WHat do you mean by report ? Is it a report like from Reporting Services or is it just a results set from a query ? DO you want to swnd it via SQL Mail or SMTP ? DO you use SQL 2k or SQL 2k5 ?

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de|||I want to send an export via smtp using sql 2005. Is there a built-in stored procedure that will allow me to send an smtp message, and attach my export csv.|||You could use the new Database Mail feature. But for your needs it is easier to use a SSIS package since you can export the data from table(s) to file and email it using built-in tasks. You could do the same within SQL Server also but you have to xp_cmdshell to run BCP out and that poses security risks among other things.

No comments:

Post a Comment