March 10, 2011 at 11:54 am
Can anyone tell me if there is a way to write a message to the SQL Server 2008 R1 error log from TSQL?
March 10, 2011 at 11:56 am
RAISERROR ... WITH LOG
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 10, 2011 at 11:59 am
Hmm. I hadn't thought about RAISERROR. Won't that kill the current batch too though?
March 10, 2011 at 12:07 pm
This seems to work without killing the batch.
raiserror ('test', 0, 0) with log;
Thanks for the tip, Gail!
March 10, 2011 at 12:10 pm
Anything with a Severity <= 10 will be treated as "informational" and will not affect batch execution (i.e. will not set @@error). It will however cause data to be sent to the caller on the info messages stream which can trip up some less-savvy data access layers.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply