3

So I was trying to put in a RaisError statement earlier today, and accidentally put it in as follows:

RaiseError ('Some error message', 16, -1)

Note the extra e.

Naturally, it threw an error, as it was meant to be RaisError, but what caught me off guard was the fact that in SSMS 2012, RaiseError was syntax-highlighted pink, as if it was a system function. So when I was writing it, I didn't notice I added an extra e until I tried to run it.

That got me wondering what RaiseError was used for. I hit up MSDN and Google trying to find some information or documentation about RaiseError, but I could not find anything that even hinted at its existence. Everything I found referred to RaisError.

What purpose does RaiseError serve, and how is it used? Is this even a thing? Are my Google skills failing me, or is this just a bug in SSMS making an already confusing naming convention more confusing?

Siyual
  • 16,415
  • 8
  • 44
  • 58
  • 1
    The color syntax highlighting in SSMS is imperfect. Recognizing pink vs. blue in this case is probably about as good as you're going to get - I don't think you'll ever get an answer from Microsoft about why the term in the form it *should* have been spelled in gets highlighted pink, never mind ever expect to see it fixed. – Aaron Bertrand May 23 '14 at 18:25
  • Understandable, but would that mean that `RaiseError` by itself isn't actually a function? – Siyual May 23 '14 at 18:29
  • Yes, I don't think it's a function. – SeeJayBee May 23 '14 at 18:30
  • 1
    Found some related stuff http://dba.stackexchange.com/a/22661 – Yuriy Galanter May 23 '14 at 19:50

1 Answers1

0

RaiseError was depreciated in SQL 2008, and no longer in 2012. RaiseError was the old format of RaisError without a "()"

The Following article here mentions below: Microsoft Article

Transact-SQL The RAISERROR (Format: RAISERROR integer string) syntax is deprecated. Rewrite the statement using the current RAISERROR syntax. Oldstyle RAISEERROR 164

Will
  • 104
  • 3
  • 5
    I actually think that's a typo in the doc. Ironically. – Aaron Bertrand May 23 '14 at 18:27
  • Yes, I don't think this answer is correct. I just tried RAISEERROR (with two 'E's) in SQL Server 2005, and it doesn't work. – SeeJayBee May 23 '14 at 18:30
  • Right, it also doesn't work in 2000 - I proved this, then posted a screenshot with syntax errors, then shut down my VM with 2000 running. I can assure you this is merely a typo in the documentation. – Aaron Bertrand May 23 '14 at 18:43