SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Running SQL queries & attach to email
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

6 Posts

Posted - 12/11/2012 :  06:51:33  Show Profile  Reply with Quote
Is there any Application to Running SQL queries & attach to email with scheduler .

Please support. Thanks

Ahmed Soliman

Flowing Fount of Yak Knowledge

United Kingdom
3383 Posts

Posted - 12/11/2012 :  07:11:37  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
Have a look at dbmail.

Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Flowing Fount of Yak Knowledge

United Kingdom
2153 Posts

Posted - 12/11/2012 :  07:17:26  Show Profile  Visit jackv's Homepage  Reply with Quote
SQL Server comes with Database Mail . Configure Database mail and then use the msdb.dbo.sp_send_dbmail stored procedure ,with SQL Server Agent . Here is an example of the built in stored procedure. Using the @attach_query_result_as_file will attach the query results

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Main',
@body = 'some body text',
@subject = 'some subject text' ,
@recipients = 'user1@sqlserver-dba.com',
@execute_query_database = 'MY_DB',
@attach_query_result_as_file = 1,
@query = 'EXEC mySp'

Jack Vamvas
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000