When I bring up SQL Prompt intellisense from this point:
DECLARE @Table TABLE ( ID INT )
INSERT INTO @Table
( ID
)
SELECT TOP 10
object_id
FROM sys.all_objects
SELECT *
FROM sys.all_objects
WHERE object_id IN ( SELECT ID
FROM @T
...and let it autocomplete, it results in this:
DECLARE @Table TABLE ( ID INT )
INSERT INTO @Table
( ID
)
SELECT TOP 10
object_id
FROM sys.all_objects
SELECT *
FROM sys.all_objects
WHERE object_id IN ( SELECT ID
FROM [@Table] )
...and that is just NOT proper syntax for selecting from a table variable, there should be no squared brackets. Running the statement (with the closing parentheses) will result in:
(10 row(s) affected)
Msg 208, Level 16, State 1, Line 6
Invalid object name '@Table'.
When using SQL Prompt to auto-complete the insert into a the table variable, it works correctly.
...and let it autocomplete, it results in this:
...and that is just NOT proper syntax for selecting from a table variable, there should be no squared brackets. Running the statement (with the closing parentheses) will result in:
When using SQL Prompt to auto-complete the insert into a the table variable, it works correctly.