How can we help you today? How can we help you today?

SQL Prompt 10.14.21.9884 semi-colon syntax problem

Good morning,

I'm seeing an issue where I have a THROW in a BEGIN/END statement, and unless I preface the THROW with a semi-colon, SQL Prompt sees it as an issue.

I don't recall SQL syntax requiring a prefixed semi-colon?

SQL Prompt 10.14.21.9884
SSMS 20.1.10.0
Windows 11 latest



This is the code:


SET NOCOUNT ON;

--
-- Validation
--
IF @... NOT IN ('gl', 'accts')
BEGIN
    THROW 60000, N'Parameters not passed correctly.', 1;
    RETURN;
END;

jsreynolds1
0

Comments

3 comments

  • DanC
    Hi @jsreynolds1

    Sorry, to hear you're experiencing this issue!

    I'm going to raise this with the developers and I'll keep you posted on further updates!
    DanC
    0
  • emmar00
    While T-SQL syntax typically does not require semicolons, THROW is an exception.

    Microsoft docs: "The statement before the THROW statement must be followed by the semicolon (;) statement terminator."

    Yes, even if the previous "statement" is BEGIN. So just add a semicolon in there and you will be good to go.
    emmar00
    0
  • jsreynolds1
    @emmar00 Good lord, I never knew that. Thanks for pointing it out.
    jsreynolds1
    0

Add comment

Please sign in to leave a comment.