Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 2005 server agent job failed

Author  Topic 

waja
Starting Member

6 Posts

Posted - 2010-08-18 : 06:09:42
Earlier, my server agent job is able to send out email at the interval set by me. However, after i changed the query command inside server agent job (step). it stopped sending out mail completely.

Can some guru please look at the following commands and advice me on my mistake.

TIA


EXEC msdb.dbo.sp_send_dbmail

@Profile_Name = 'Mail Alert',
@Recipients = 'John@yahoo.com',
@Query = 'SELECT TOP 10 * FROM Prod.dbo.Trans WHERE Prod_code <> '' ORDER BY Tr_date+Tr_time DESC',
@Subject = 'Latest Transaction AddRecorded',
@Attach_Query_Result_As_File = 1





waja

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2010-08-18 : 06:30:01
syntax error? singles quotes should be double quotes inside a text string

WHERE Prod_code <> ''''

--------------------
keeping it simple...
Go to Top of Page

waja
Starting Member

6 Posts

Posted - 2010-08-18 : 06:56:37

Thanks for your help Jen, but I've successfully tested this command in the management studio query windows before i copy and patch it into the server job (step)?

waja
Go to Top of Page
   

- Advertisement -