Tagged Questions
4
votes
1answer
106 views
Raising an error with a system message_id in SQLCLR
If call CREATE DATABASE foo twice I get the error message:
Msg 1801, Level 16, State 3, Line 1
Database 'dropme' already exists. Choose a different database name.
The error message is listed in ...
5
votes
3answers
265 views
Write to Error Log
Using SQL Server 2008 R2:
How can I write to the SQL Server Error Log? I have a ROLLBACK statement that I'd like to couple with a statement written to the error log for external monitoring.
...
5
votes
2answers
432 views
Error handling in container procedures
I'm aware of and use the techniques in this question.
In my environment we have a lot of container procedures that call subprocedures, that may call other procedures, ad infinitum.
For me ...
2
votes
2answers
427 views
Running a number of .sql files using SQLCMD
I'm trying to put together a batch file to run a large number of .sql files without doing so individually.
So far I have:
@echo off
echo "Enter Server"
set /p SERVER=
echo "Enter Database"
set /p ...
1
vote
1answer
1k views
Changed database context to 'MyDbName'
I am catching all errors on my Sql Server, I got errors:
Changed database context to 'MyDbName'.
Changed language setting to us_english.
I haven't found any clear explanation of problem and ...
0
votes
1answer
286 views
Make SQL Server Agent retry failed script with Try/Catch
I have a script that has a try catch in it so that if it fails I can roll back the transaction. It runs on a job scheduled through SQL Server Agent. But when it fails SQL Server Agent does not see ...