SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
4.0.24 BETA - MSSQL temp tables

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
4.0.24 BETA - MSSQL temp tables
Author Message
jrandall



Joined: 06 Oct 2008
Posts: 27
Country: United States

Post 4.0.24 BETA - MSSQL temp tables Reply with quote
This may have already been brought up, but SQL Assistant doesn't seem to recognize a temp table in a script after it has been created. Ex:

=======================
-- Create temp table
CREATE TABLE #StoredProcedures
(OID int IDENTITY (1,1) ,StoredProcSchema varchar ( 128 ) Not NULL,StoredProcName varchar ( 128 ) Not NULL );

-- 4 - Populate temporary table
INSERT INTO #StoredProcedures ( StoredProcSchema, StoredProcName )
SELECT ROUTINE_SCHEMA, ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME Not Like 'dt_%' AND ROUTINE_NAME NOT LIKE 'sp_%' And ROUTINE_TYPE = 'PROCEDURE'
ORDER BY ROUTINE_NAME;
============================

The reference to #StoredProcedures in the INSERT statement has a red squiggly line under it. See this in SSMS 2005 & SSMS 2008
Mon Oct 20, 2008 3:01 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 6499

Post Reply with quote
I cannot reproduce it in SQL 2005. Which symbol do you have in SQL Assistant options as a batch separator for your environment?

By the way, the syntax check is done by the db server, SQL Assistant simply highlights the places where db server thinks you have an error. SQL is sent in batches. If you create a temp table in one batch but refer to it in another batch, at the time of the syntax check of the second batch, the table reference is invalid, db server doesn't know that the table will be created at the time when the code is run, so it reports that reference as not valid.
Mon Oct 20, 2008 4:20 pm View user's profile Send private message
jrandall



Joined: 06 Oct 2008
Posts: 27
Country: United States

Post SQL Assistant 4.0.24 beta MSSQL temp tables Reply with quote
I'm using GO as the batch separator, but your second sentence explains what is happening, and it makes perfect sense. By the way, I have to tell you folks how impressed I am with SQL Assistant. I've been using SQL Prompt for 2 years, but I'm a convert! Great tool!
Mon Oct 20, 2008 6:55 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.