x

Where does Throw stores it's message numbers

For RaiseError,the message number should exist in sys.messages( even for custom messages). For Throw(Denali), it will be what?

e.g. if I do as

BEGIN TRY
    SELECT 1/0 
END TRY
BEGIN CATCH 
    THROW 50002, 'Some custom message.', 5
END CATCH

I will receive

Msg 50002, Level 16, State 5, Line 5 Some custom message.

and we know that the valid range for THROW is between 50000 to 2147483647. That means these custom message numbers will be stored/declared somewhere(in some table)[for RaiseError it is in sys.messages]. So which is it? Although the predefined messages are still from sys.messages

N.B.~ It is for my own understanding

Thanks
more ▼

asked Feb 13, 2011 at 07:53 PM in Default

learner gravatar image

learner
302 17 18 20

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

You can continue to use error messages in sys.messages but don't have to:

[THROW (MSDN)][1]

I will continue to use sys.messages as it allows you to have a set of error messages with a centralised standard message content.

(Please remember that Denali is still in development so things can change from now until release)

[1]: http://msdn.microsoft.com/en-us/library/ee677615(SQL.110).aspx
more ▼

answered Feb 13, 2011 at 11:52 PM

WilliamD gravatar image

WilliamD
25.9k 17 19 41

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x13

asked: Feb 13, 2011 at 07:53 PM

Seen: 625 times

Last Updated: Feb 13, 2011 at 08:14 PM