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 2008 Forums
 Transact-SQL (2008)
 error message in Agent

Author  Topic 

avijit_mca
Posting Yak Master

109 Posts

Posted - 2010-07-17 : 09:12:15
i am running a script.

SQL Statement ....
while @x >=3
begin try
exec('insert into'+ @tab +'
select * from xyz1 where ......')

select @tab
end try
begin catch

select @error_message(),'Message..'
end catch
end while

when i am running it from SSMS its
return result set.

it showing error message display.

Error message etc.

But when i make it schedule from agent service it is not display any error message.
how i will display error message in sql server agent job.




Regards,
avijit

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2010-07-19 : 20:04:03
How do you know that it's not showing anything when it's running as a SQL Job?

Look up "WITH LOG" option of RAISERROR to see if it might be a way to preserve your messages.

=======================================
A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007)
Go to Top of Page
   

- Advertisement -