|
Prev: Your win 10,000$ in my groups Pls register your name and address in below of the website http://www.geocities.com/cathrina39
Next: There is insufficient system memory to run this query - system.web
From: Don Juan on 19 Jul 2008 04:06 Hi all What is the best way in order to send an SQL query via e-mail? What can I do in sql server side? or programatically? (VB or C#) Thanks in advanced. dj
From: Plamen Ratchev on 19 Jul 2008 08:17 Assuming you mean the query results, you can use the system stored procedure sp_send_dbmail using the @query parameter. Here is example: EXEC msdb.dbo.sp_send_dbmail @profile_name = 'MyProfile', @recipients = 'foo(a)test.com', @query = 'SELECT col1 FROM Foo' , @subject = 'Query results', @attach_query_result_as_file = 1 ; HTH, Plamen Ratchev http://www.SQLStudio.com
From: Don Juan on 22 Jul 2008 01:57
Thanks! "Plamen Ratchev" <Plamen(a)SQLStudio.com> wrote in message news:52F0D1A7-5805-48B4-89E2-A59DE7BCA005(a)microsoft.com... > Assuming you mean the query results, you can use the system stored > procedure sp_send_dbmail using the @query parameter. Here is example: > > EXEC msdb.dbo.sp_send_dbmail > @profile_name = 'MyProfile', > @recipients = 'foo(a)test.com', > @query = 'SELECT col1 FROM Foo' , > @subject = 'Query results', > @attach_query_result_as_file = 1 ; > > HTH, > > Plamen Ratchev > http://www.SQLStudio.com > > |