Reputation:
I open a new query in ssms and create a global temp table. I then open a new query window in ssms and write sql to insert data in the fields. But in the new query window intellisense does not recognize the temporary table. The sql works fine and the data is inserted into the temp table and I can work with the temp table but without intellisense. I can return to the original query window where the table was created and intellisense work fine. I have tried refreshing intellisense, it doesn't work. Any suggestion will be appreciated.
Table code is
CREATE TABLE ##UserInfo
(
[UserId] int NOT NULL IDENTITY (1, 1),
[strEmail] varchar(50) NULL,
[strLastName] varchar(50) NULL,
[strFirstName] varchar(50) NULL,
)
Insert code
insert into ##Userinfo(strLastName,strFirstName)
select distinct POC_DATA.POC_LNAME, POC_DATA.POC_FNAME
from POC_DATA
The bold is the part intellisense does not recognize in the different query window
Upvotes: 3
Views: 989
Reputation: 4445
So far the only "trick" I have been able to come up with is to include the "CREATE TABLE" command in a block that will never execute, but intellisense will see, like so:
IF 1=0
BEGIN
CREATE TABLE ##UserInfo (
[UserId] int NOT NULL IDENTITY (1, 1),
[strEmail] varchar(50) NULL,
[strLastName] varchar(50) NULL,
[strFirstName] varchar(50) NULL,
);
END
It would be nice if you could put into a comment, but alas intellisense ignores that.
Upvotes: 6