February 15, 2007 at 2:05 pm
hi guys i hope you can help me..... i am working with two access databases front end and sql server backend .
i have a query that makes a comparison of one table in each database and the results are the items that don't match from table 1 in table 2.
I need to create a DTS that runs every day that if there are rows in this query then to send an email with the information...
Can this be done? I could create the queries into sql tasks but not sure what to do next.... please help
February 15, 2007 at 3:50 pm
Try
Exec Master..xp_sendmail @recipients = @Precipients
,@message = @Pmessage
,@query = @Pquery
,@attachments = 'Data.xls'
,@subject = @Psubject
,@attach_results = 'TRUE'
,@width = 9999
,@separator = @sepchar
,@dbuse = @DBName
Obviuosly you need to declare all the variables and initialise them before calling the Master..xp_sendmail.
Then you need to set @Pquery to your query. Also this assumes that you properly set up SQL Mail on your server.
February 16, 2007 at 1:07 pm
hi, is there a way to put on the code that if the query shows no results then not to send an email ?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply