﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 7,2000 / T-SQL  / Create a scheduled task to email from SQL / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 02:46:47 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>This is a different question.  You should start a new topic.</description><pubDate>Mon, 01 Dec 2008 11:44:42 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Hi Guys,back already!!!!!Right.... i got the xp_sendmail function working and have started to have a play with the CDONTs functions which to my surprise I have managed to do and send a HTML bodied email from the SQL server without requiring Outlook to be installed on it, now to be a complete pain:I want to be able to send the results from a working stored procedure as various attachments to this pretty HTML email that CDONTs produces. I have been able to send SP's as attachments using the xp_sendmail function which seems pretty straight forward but would like to use the CDONTs now as it seems like a more powerful way. The formats that I want to be able to attach are 1 SP to a csv file and 1 SP to a pdf file. They don't necessarily have to be on the same email but also is that possible?thanks again for all your previous help and thanks in advance for the help to follow!!!:D</description><pubDate>Mon, 01 Dec 2008 10:30:50 GMT</pubDate><dc:creator>Arif Hafeez-Imam</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Glad we could help.</description><pubDate>Tue, 11 Nov 2008 07:15:08 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>cheers for the help, will have a play and let you know the outcome.thanks again</description><pubDate>Tue, 11 Nov 2008 01:25:59 GMT</pubDate><dc:creator>Arif Hafeez-Imam</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>You can find this in BOL(Books Online).  If you still need help, then please start a new topic.</description><pubDate>Mon, 10 Nov 2008 16:38:06 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Hi,I want to send mail's from sql , eg: Consider table as Table1 , with  1 column as modifiedon, When the modifiedon  date is greated than 2 days of last modified date than mail has to be automatically sent to users.In google i read this can be done in SQLMAil,Can you please give me details steps to do this.Thanks in Advance,Archana</description><pubDate>Mon, 10 Nov 2008 02:00:32 GMT</pubDate><dc:creator>yukthi</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>This is probably caused by commas in your string-based columns.  You will need to put quotation marks around the columns that might have commas embedded in their text.  Alternatively, use a different separator character (like TAB) that you are sure will not be in any of the columns.</description><pubDate>Wed, 22 Oct 2008 12:20:54 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Yeah I think i will stick to the xp_sendmail function for now as it seems to be a bit quicker and easier to use. Will defo read up on it tho.Cheers!!With the code belowEXEC master.dbo.xp_sendmail	@recipients = N'', 	@query = N'EXEC RPT_3_Daily ''21-oct-2008''',	@subject = N'UK1428',	@message = N'Please find new information attached.',	@attach_results = 'TRUE',	@width = 250,	@separator = ',',	@no_header = 'TRUE',	@attachments = 'New.csv'the attachment I receive doesn't sit in the columns properly, I have opened the file up using notepad++ which displays a lot of "NULL" values when the stored procedure to be run contains characters as well as numerics in the results, however if I use the same code as above and use a stored procedure that will only produce numbers then the csv displays fine and even opens in excel, is there something else that I have missed off to allow the file produced display and organise the alphanumeric characters correctly within excel?</description><pubDate>Wed, 22 Oct 2008 11:10:17 GMT</pubDate><dc:creator>Arif Hafeez-Imam</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>You can send emails without outlook just with cdosys. Take a look at  How to send e-mail without using SQL Mail in SQL Server [url]http://support.microsoft.com/kb/312839/en-us[/url]</description><pubDate>Wed, 22 Oct 2008 03:15:04 GMT</pubDate><dc:creator>Ramon Jimenez</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Log in to the SQL Server's Outlook client &amp; mailbox yourself on the Server and try to set your defaults that way.</description><pubDate>Tue, 21 Oct 2008 10:58:47 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>And lastly.. i promiseis there a way to make the email being sent using the guidelines above in HTML format? and if so how?Thanking you!!!!!</description><pubDate>Tue, 21 Oct 2008 10:36:29 GMT</pubDate><dc:creator>Arif Hafeez-Imam</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Glad it worked out for you.</description><pubDate>Tue, 21 Oct 2008 08:21:59 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Thanks to everyone for their help, all working now.:D</description><pubDate>Tue, 21 Oct 2008 07:48:49 GMT</pubDate><dc:creator>Arif Hafeez-Imam</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>So you can control the name of the attachment, use the [b]@attachments [/b]parameter for xp_sendmail.I suggest you also review the online help for the [b]@separator [/b]parameter since you mention you would be using CSV extension.------Robert</description><pubDate>Tue, 21 Oct 2008 02:49:50 GMT</pubDate><dc:creator>rcavill</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Thanks for the help,I have managed to install an outlook client on the server and restarted the services and the above code works however it attachs the query as a .txt file, is there a way for me to make it send as a csv?</description><pubDate>Tue, 21 Oct 2008 02:07:49 GMT</pubDate><dc:creator>Arif Hafeez-Imam</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Fair warning:  Installing Outlook on a Server is no small feat.  It takes some work.</description><pubDate>Mon, 20 Oct 2008 10:50:55 GMT</pubDate><dc:creator>RBarryYoung</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Outlook has to be installed using the SQL Server service account and have a profile for that account.  So you need a domain account for SQL Server to send this email.</description><pubDate>Mon, 20 Oct 2008 09:40:53 GMT</pubDate><dc:creator>  Jack Corbett</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Thanks for this,I have used the query below:EXEC master.dbo.xp_sendmail    @recipients = N'name@domain.com',     @query = N'EXEC ComSys..RPT_3_DailyEmail ''17-oct-2008''',    @subject = N'SQL Server Report',    @message = N'Test',    @attach_results = 'TRUE',    @width = 250 ;and it throws back an error of:Server: Msg 18030, Level 16, State 1, Line 0xp_sendmail: Either there is no default mail client or the current mail client cannot fulfill the messaging request. Please run Microsoft Outlook and set it as the default mail client.I have since installed outlook on the SQL server and set microsoft outlook to the default mail client but it still displays the error above.What else have I missed?Thanks again</description><pubDate>Mon, 20 Oct 2008 09:27:00 GMT</pubDate><dc:creator>Arif Hafeez-Imam</dc:creator></item><item><title>RE: Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Lookup xp_sendmail in BOL.  Set @query, @attach_results, and @separator parameters.ORIf you are using 2000 and have Reporting Services you could setup a subscription in RS.</description><pubDate>Mon, 20 Oct 2008 07:43:03 GMT</pubDate><dc:creator>  Jack Corbett</dc:creator></item><item><title>Create a scheduled task to email from SQL</title><link>http://www.sqlservercentral.com/Forums/Topic588490-8-1.aspx</link><description>Hi,is it possible to get SQL to email information that it has collected from a query as an attachment in csv format?I am able to email the information in question using an SQL query however I only know how to put it into the body of the email and not as a csv attachment. Please could someone help me?Arif</description><pubDate>Mon, 20 Oct 2008 06:10:59 GMT</pubDate><dc:creator>Arif Hafeez-Imam</dc:creator></item></channel></rss>