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 PRINT
statement some lines above the RAISERROR. Didn't know that (unrelated) PRINT statements get appended to the error message!
PRINT 'Fee fie fo fum'
<snip>
if @a = @b
RAISERROR('blah blah blah', 11, 1)
return
Client-side the SqlException Message property is "blah blah blah" + CRLF + "Fee fie fo fum"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.