May 9, 2006 at 1:08 pm
Somebody please rescue me from the hours and hours that I am spending trying to find the answers to some questions about Extended Stored Procedures and the SQL Error Logs!!
1) The extended stored procedure C/C++ API function srv_sendmsg is able to produce error messages that show up in red, etc. when executed from Query Analyzer, just like raiserror. The raiserror statement has an optional with log qualifier that will cause it to write the SQL Error Logs. Is there a way to make srv_sendmsg write to the SQL Error Logs?
2) When an extended stored procedure is executed as part of an insert into … exec statement, all src_sendmsg output is lost. And, since I can’t make it write to the SQL Error Logs, it’s really lost. (For the record, insert into … exec with a regular stored procedure containing a raiserror statement works fine.)
Thanks in Advance,
MultiMedia
May 9, 2006 at 2:29 pm
1) srv_sendmsg just sends a text message (no color) to SQL Server. You can send use the SRV_MSG_ERROR msgtype, set the class > 10 and the state (0 - 255) to return an Error back to SQL, which you should then be able to log. Alternatively you could set an output param on your XP and decide whether to RAISERROR based on the value there.
2) Are you sending it with the SRV_MSG_ERROR msgtype or the SRV_MSG_INFO?
I usually create two functions, one which sends a SRV_MSG_ERROR message back to SQL Server, and one which sends SRV_MSG_INFO messages back.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply