How to determine a TSQL error is a runtime error or parse error? For example, when I execute
asdf
I’ll get
Msg 2812, Level 16, State 62, Line 1 Could not find stored procedure
‘asdf’.
When I execute
asdf sdf asdf
I’ll get
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ‘asdf’.
You can use the level to differentiate between different kinds of errors. See this for description of error levels: Database Engine Error Severities.
If you need to you can also use the error messages which are listed in
sys.messagesbut keep in mind that there are about 9000 different possible messages.