December 29, 2005 at 10:55 am
Hello guys.
I'm wondering the way how to log the printed execution messages (mainly error msgs) into a table. I'm looping into a cursor to automate a bit more the backup procedure.
Any clue?
Thanks
PS. Happy holydays!
December 29, 2005 at 11:37 am
Hi,
What do you mean:
1. Do you wnat SQL Server Errors to be logged to a table from within SQL?
OR
2 Do you wnat error messages from the front end to be logged to a table?
#1: Messages could be logged to the Apllication Event Log and loaded to the table from there
#2 Front End (your application) can trap errors coming from any source and log them into the table
#3 Use SQL server 2005. Please see
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/sql_ovyukondev.asp
with this example: "........Furthermore, errors such as data type conversion errors caused your batch to terminate, so you couldn't trap those with Transact-SQL. SQL Server 2005 addresses many of these issues by introducing a simple but powerful exception handling mechanism in the form of a TRY/CATCH Transact-SQL construct..."
Regards,Yelena Varsha
December 29, 2005 at 1:48 pm
For example, this is the resulting message from a SP trying to backup a non-existent DB:
Server: Msg 911, Level 16, State 1, Procedure usp_FullBackupDb, Line 25 Could not locate entry in sysdatabases for database 'borrasca'. No entry found with that name. Make sure that the name is entered correctly. Server: Msg 3013, Level 16, State 1, Procedure usp_FullBackupDb, Line 25 BACKUP LOG is terminating abnormally. Server: Msg 911, Level 16, State 1, Procedure usp_FullBackupDb, Line 27 Could not locate entry in sysdatabases for database 'borrasca'. No entry found with that name. Make sure that the name is entered correctly. Server: Msg 3013, Level 16, State 1, Procedure usp_FullBackupDb, Line 27 BACKUP DATABASE is terminating abnormally. Server: Msg 3201, Level 16, State 2, Procedure usp_FullBackupDb, Line 34 Cannot open backup device 'E:\SqlBak\borrasca FullBackup.BAK'. Device error or device off-line. See the SQL Server error log for more details. Server: Msg 3013, Level 16, State 1, Procedure usp_FullBackupDb, Line 34 VERIFY DATABASE is terminating abnormally.
This is the kind of messages I'd like to store
Thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy