SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Bye Bye to the RAISERROR Function?


Bye Bye to the RAISERROR Function?

Author
Message
calbimonte.daniel
calbimonte.daniel
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1766 Visits: 454
Comments posted to this topic are about the item Bye Bye to the RAISERROR Function?
Danny Ocean
Danny Ocean
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2876 Visits: 1549
informative information. thx

Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
www.GrowWithSql.com
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)

Group: General Forum Members
Points: 378275 Visits: 42934
By default, the Throw statement always has the severity of 16.


Microsoft deprecates yet another incredibly useful tool and replaces it with a piece of garbage with much fewer capabilities.

The "advantages" you have for THROW are actually disadvantages for me especially when it comes to THROW having fewer parameters. I really hope this is April Fools joke. I'm totally disgusted with what Microsoft thinks "improvements" actually are.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Geoff A
Geoff A
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4876 Visits: 1828
Jeff Moden (4/3/2012)
By default, the Throw statement always has the severity of 16.


Microsoft deprecates yet another incredibly useful tool and replaces it with a piece of garbage with much fewer capabilities.

The "advantages" you have for THROW are actually disadvantages for me especially when it comes to THROW having fewer parameters. I really hope this is April Fools joke. I'm totally disgusted with what Microsoft thinks "improvements" actually are.


Recommending it in SQL 2012 means we have it for at least 3 more releases... I don't know about you, but SQL 2020 sounds like a long time from now. :-P :-P :-P
And of course, if there is enough complaining, Microsoft will fix THROW's short comings.
Geoff A
Geoff A
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4876 Visits: 1828
actually, Microsoft has not stated that RAISERROR is deprecated at all. It is still a valid command.
what is ACTUALLY not possible in SQL 2012 is using RAISERROR like this;

RAISERROR 50001 'this is a test'



in which case THROW would be the only choice.

the code
RAISERROR 50001 'this is a test'

will work in SQL 2008 R2 and lower however, THROW will not. (because it does not exist)


please correct your article to show this as it may cause FUD as it did with me.....
Steve Jones
Steve Jones
SSC Guru
SSC Guru (248K reputation)SSC Guru (248K reputation)SSC Guru (248K reputation)SSC Guru (248K reputation)SSC Guru (248K reputation)SSC Guru (248K reputation)SSC Guru (248K reputation)SSC Guru (248K reputation)

Group: Administrators
Points: 248133 Visits: 19805
Jeff Moden (4/3/2012)
[quote]
The "advantages" you have for THROW are actually disadvantages for me especially when it comes to THROW having fewer parameters. I really hope this is April Fools joke. I'm totally disgusted with what Microsoft thinks "improvements" actually are.


And here I thought it was a better move. RAISERROR can depend on sys.messages, which creates a dependency for the database on the instance. This can easily cause issues in DR situations, or database moves. The idea of getting more contained inside databases means we need a better way. I suppose RAISERROR could have been modified to use a database table, but I'm not sure THROW is a bad move.

It probably needs a little more work, and I'd encourage you to submit ideas to CONNECT and get people to vote for them. I think THROW will work well in the future.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)

Group: General Forum Members
Points: 378275 Visits: 42934
Steve Jones - SSC Editor (4/3/2012)
Jeff Moden (4/3/2012)
[quote]
The "advantages" you have for THROW are actually disadvantages for me especially when it comes to THROW having fewer parameters. I really hope this is April Fools joke. I'm totally disgusted with what Microsoft thinks "improvements" actually are.


And here I thought it was a better move. RAISERROR can depend on sys.messages, which creates a dependency for the database on the instance. This can easily cause issues in DR situations, or database moves. The idea of getting more contained inside databases means we need a better way. I suppose RAISERROR could have been modified to use a database table, but I'm not sure THROW is a bad move.

It probably needs a little more work, and I'd encourage you to submit ideas to CONNECT and get people to vote for them. I think THROW will work well in the future.


Adding THROW is a great idea. Removing RAISERROR is a horrible idea. I'm going to write an article on how to use RAISERROR the way I use it, show that it can't be done with THROW, and open a CONNECT item pointing to the article.

From where I sit, THROW needs a hell of a lot of work to even come close to the easy functionality you can get out of RAISERROR. Does RAISERROR have some problems? You bet. And they should fix those problems instead of removing still more functionality. Considering all the things that THROW cannot do, I'm 100% sure that I'll never use it. Heh... same goes for FORMATMESSAGE. Way too much work and employs the very same technology/requirements that so many say you have to do with RAISERROR to make it useful and nothing could be further from the truth there.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Geoff A
Geoff A
SSCarpal Tunnel
SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)SSCarpal Tunnel (4.9K reputation)

Group: General Forum Members
Points: 4876 Visits: 1828
RAISERROR is not being removed!!!

the only functionallity that has changed it you cannot pass RAISERROR less the ()

you use to be able to send
RAISERROR 50000 'this is a test' 


without the ()

in SQL 2012, if you want to use
RAISERROR 50000 'this is a test' 

it will fail. but in SQL 2012 you can still use
RAISERROR ('this is a test',16,1)



or in SQL 2012, you can just use THROW.

all other forms of RAISERROR still work as always in SQL 2012 and Microsoft clearly states this on the links at the front of the article.
other usefull info is located here;
http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/81ef8f38-7ddc-486b-983c-18dbf7be412d
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)SSC Guru (378K reputation)

Group: General Forum Members
Points: 378275 Visits: 42934
Thanks for the "warm fuzzies" and facts on the plight (or lack of, I should say) of RAISERROR especially considering the name of this article. I finally had the time to go check the deprecation list for 2k12 and I'm very happy to see that it's not on there except for the () problem.

I'm still going to write an article about RAISERROR and some of the nifty things you can do with it without getting into sys. Messages. I just don't trust MS much when they say things in their official BOL documentation like "New applications should use THROW instead" ( http://msdn.microsoft.com/en-us/library/ms178592.aspx )regardless of context. They said similar about sp_MakeWebTask way back in 2k when SSRS was nothing but an addon. If no one has already done it, I'll still open a CONNECT item to suggest that they really need to add some functionality like being able to supply an optional severity level, etc. Whistling

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
calbimonte.daniel
calbimonte.daniel
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1766 Visits: 454
Yeah, when I wrote the article the BOL said, that they were going to remove it in future releases. It seems that they changed their minds and updated the BOL.

RAISERROR is nice, but MS had some problems with it and the try catch clauses and severities. If you are using them and you have sql 2k12, you should use the Throw instead.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search