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

avatar image

learner
302 17 19 22

(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)

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, 2011 at 11:52 PM

avatar image

WilliamD
26.2k 18 33 48

(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: 698 times

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

Copyright 2016 Redgate Software. Privacy Policy