My fairly simple stored procedure does this on line 44:
IF @a = @b
RAISERROR('blah blah blah', 11, 1)
RETURN
The stored procedure is invoked client-side using the .NET Framework System.Data.SqlClient library:
try
{
SqlCommand c = new SqlCommand();
c.CommandType = CommandType.StoredProcedure;
c.CommandText = "procname";
c.ExecuteNonQuery() // execute the stored procedure
}
catch(SqlException sex)
throw sex;
catch(Exception ex)
{
throw ex;
}
When ex is caught, its value is blah blah blah + CRLF + 1259
Where is that 1259 coming from? Does it correspond to severity 11?
Aha! Just found it. There's a
PRINTstatement some lines above the RAISERROR. Didn't know that (unrelated) PRINT statements get appended to the error message!Client-side the SqlException Message property is "blah blah blah" + CRLF + "Fee fie fo fum"