ADDING A USER-DEFINED MESSAGE V7.0 The SQL Server master database includes a table called sysmessages. This table houses the SQL Server error messages returned when a compile-time or runtime problem occurs. You can add your own user- defined messages (UDM) to this table and raise them via the RAISERROR function. (Note that UDM error numbers must be greater than 50,000.) The following statements demonstrate how the RAISERROR function works. The syntax for sp_addmessage [@msgnum =] msg_id, -- between 50,001 and 2,147,483,647 [@severity =] severity, -- 1 through 25 with 20 - 25 considered fatal [@msgtext =] 'msg' -- the text of the message [, [@lang =] 'language'] -- optional language specification [, [@with_log =] 'with_log'] -- optional write to log [, [@replace =] 'replace'] -- if specified, replaces existing message USE master EXEC sp_addmessage 50001, 1, 'You must enter a rating between zero (0) and nine (9) Please check the value and reexecute.' When your application encounters this error during processing, you can use the RAISERROR function to deliver the UDM to the client or write to the SQL error log depending upon the severity. For this example, we will send the information to the client. RAISERROR (50001,1,1) Msg 50001, Level 1, State 50001 You must enter a rating between zero (0) and nine (9). Please check the value and reexecute. You can get creative when defining your own user-defined error messages. Review MSDN Books Online for more information regarding sp_addmessage, RAISERROR, sp_dropmessage, and sp_altermessage. http://click.techrepublic.com/Click?q=be-B7RxQCpTZlAxXf1rnS4VvjomgdRR ------------------------------------------ Back by popular demand MONITOR YOUR SERVERS WITH THE WINDOWS NT EVENT VIEWER Are your Windows NT servers behaving properly? The Event Viewer can help you keep a close eye on them. In this sample article from TechProGuild, Troy Thompson walks you through how to use this invaluable utility. http://click.techrepublic.com/Click?q=c6-URl9QMLKgFr_hgSJdXTBeL4yhsRR AUTOCONFIGURE SQL SERVER LOGGING TO ELIMINATE MANUAL UPDATES If you're like most administrators, you're always on the lookout for ways to save time. Try autoconfiguring your SQL Server to eliminate the need for manual logging. http://click.techrepublic.com/Click?q=fd-BXOMQgOrlrPZVPVu_Oa6ii05v9RR ------------------------------------------