What are the challenges you face when working across database platforms? Take the survey
Options

Bug in 6.4.0.633

jmeyerjmeyer Posts: 70 Bronze 2
edited September 22, 2014 12:30PM in SQL Prompt
Repo:
IF b = 0
BEGIN
  IF @a = 0
  BEGIN
    PRINT '0'
    IF @a = 0
      PRINT '0'
  END
  ELSE
  BEGIN
    PRINT 'not 0'
  END
END
If I disable "Indent BEGIN...END blocks and then format the SQL code the formatting looks correct as seen above.
However, if I first insert semicolons via Ctrl+B, Ctrl+C nad then format the SQL code I end up with an incorrect layout as shown below:
IF b = 0
BEGIN
  IF @a = 0
  BEGIN
    PRINT '0';
    IF @a = 0
      PRINT '0';
  END;
ELSE
BEGIN
  PRINT 'not 0';
END;
END;
[/code]

Comments

  • Options
    Aaron LAaron L Posts: 596 New member
    Hi jmeyer,

    Thanks for reporting this. I can recreate this locally and will look into a fix for you. I think we might be being a tiny bit overzealous with the semicolons here anyway as I don't think they're strictly necessary after BEGIN…END even in ANSI SQL.

    Thanks,
    Aaron.
  • Options
    Aaron LAaron L Posts: 596 New member
    The private build I posted in your other thread should stop Prompt adding in the semicolons after BEGIN/END blocks hopefully helping avoid hitting this for now. I'll continue looking into a fix.
  • Options
    jmeyerjmeyer Posts: 70 Bronze 2
    Aaron:

    The private build did fix the issue on my machine.

    Thanks,
    Jens
  • Options
    Aaron LAaron L Posts: 596 New member
    Thanks Jens,

    I've just uploaded a new stable build (6.4.0.641) which should have a proper fix for this, so it will be formatted correctly even with semicolons in there.
Sign In or Register to comment.