 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
jrandall
Joined: 06 Oct 2008 Posts: 27 Country: United States |
|
4.0.24 BETA - MSSQL temp tables |
|
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 |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
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 |
|
 |
jrandall
Joined: 06 Oct 2008 Posts: 27 Country: United States |
|
SQL Assistant 4.0.24 beta MSSQL temp tables |
|
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 |
|
 |
|
|
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
|
|
|