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.
Author |
Topic |
SQLServerDBA_Dan
Aged Yak Warrior
752 Posts |
Posted - 2007-03-07 : 15:50:27
|
Ok this is driving my batty. It's been a long time since I wrote code to write to the event log. I know that you can create messages and use xp_logevent, but I thought there was something much easier. xp_writelog comes to mind. I don't see it in the server and I'm getting flustered cause I can't remember what the actual name was. Anyone know?Thanks,Daniel |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-03-07 : 15:55:21
|
RAISERROR can do this.Tara Kizer |
 |
|
SQLServerDBA_Dan
Aged Yak Warrior
752 Posts |
Posted - 2007-03-07 : 16:00:10
|
Thanks but RAISERROR uses messages as well. I thought I remembered using an XP that didnt require you use a message from the whole "sp_addmessage" thing. |
 |
|
SQLServerDBA_Dan
Aged Yak Warrior
752 Posts |
Posted - 2007-03-07 : 16:03:53
|
Maybe I'm wrong I just tested:EXEC master..xp_logevent 50050, 'TEST ERROR', errorand it worked. I did not have to create a message for 50050. I'll just use this.Thanks. |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-03-07 : 16:24:52
|
RAISERROR doesn't require that the message exist in sysmessages. You can use one of the messages in there, but you can also just use an ad-hoc message.Tara Kizer |
 |
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2007-03-09 : 09:30:51
|
thanks Dan, I was just searching for the same thing... --------------------keeping it simple... |
 |
|
|
|
|