0

I am not clear about T-SQL error severity levels as they relate to the System.Data.SqlClient library in .NET client applications. [bolded for emphasis in response to close-vote suggestion that I clarify how an answer about what severity levels "mean" does not address my question].

Which T-SQL error level(s) would allow the T-SQL statement to continue but would cause the front-end to display the message?

I thought it would be level 10 but that does not display a message in the front-end application; the docs say

For compatibility reasons, the Database Engine converts severity 10 to severity 0 before returning the error information to the calling application.

oguz ismail
  • 1
  • 16
  • 47
  • 69
Tim
  • 8,669
  • 31
  • 105
  • 183
  • Anything 10 or less. See http://www.sommarskog.se/error_handling/Part2.html#Severitylevels – Charlieface Feb 17 '21 at 21:50
  • Does this answer your question? [What do the different RAISERROR severity levels mean?](https://stackoverflow.com/questions/1122925/what-do-the-different-raiserror-severity-levels-mean) – Charlieface Feb 17 '21 at 21:51
  • @Charlieface: In my tests, RAISERROR with level 10 does NOT do anything client-side. I may be missing something. Could you please elaborate? – Tim Feb 17 '21 at 23:57
  • "10: Here is an odd one: this level can never occur. Or more precisely, if a message with level 10 is raised, the level is for "compatibility reasons" converted to 0, and thus SSMS and other tools will only print the text." – Charlieface Feb 17 '21 at 23:58
  • @Charlieface: I mentioned that in my question. – Tim Feb 17 '21 at 23:59
  • I also don't understand the close vote. What is wrong with the question? My question is specifically about how the client-side .NET SqlClient library reacts to server-side severity levels. The other question suggested does not address this. – Tim Feb 18 '21 at 00:00
  • You're right, I got the wrong duplicate. Please see https://stackoverflow.com/questions/1880471/capture-stored-procedure-print-output-in-net for how to get info messages. – Charlieface Feb 18 '21 at 00:10

0 Answers0