Options

BEGIN/END prevent Candidate List to show columns

In a new query window I write the following code:
IF EXISTS (SELECT * FROM Table1 WHERE <<cursor here>>)
Intellisense shows me list candidates and especially columns for Table1.

If I start with Begin/End block and type the same inside begin/end:
BEGIN
IF EXISTS (SELECT * FROM Table1 WHERE <<cursor here>>)
END

It does not show me the columns for Table1.

Do I miss something or this is wrong configuration?

Comments

  • Options
    Thanks for your post.

    Usually invalid SQL will break the SQL Prompt parser and cause the candidate list to function incorrectly. It seems that even though the syntax for the 1st IF EXISTS is not valid, the candidate list is still suggesting the right candidates. The SQL is invalid because there is no statement after the IF condition.

    This is not happening within the BEGIN END block, but if you add a statement after the IF condition, then the candidate list will work correctly. e.g.

    BEGIN
    IF EXISTS (SELECT * FROM Table1 WHERE <<cursor here>>)
    Print 'Record exits - Update'
    END

    It is expected behaviour that invalid SQL will cause problems with the candidate list. The development team are currently looking into ways that we can handle invalid SQL and still keep consistency with the candidate list.

    I hope this is helpful.

    Let me know if you need any more information.
    Chris
Sign In or Register to comment.