x
login about faq Site discussion (meta-askssc)

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 '11 at 07:53 PM in Default

learner gravatar image

learner
302 13 18 19

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

1 answer: sort oldest

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

THROW (MSDN)

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)

more ▼

answered Feb 13 '11 at 11:52 PM

WilliamD gravatar image

WilliamD
25.4k 16 18 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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x13

asked: Feb 13 '11 at 07:53 PM

Seen: 379 times

Last Updated: Feb 13 '11 at 08:14 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.