June 12, 2008 at 11:41 am
In SQL 2005.
I have a global temp table ##data. It is created dynamically and the column list is also dynamic.
I need to pass this table name to a stored proc and then retrieve the column list in that stored proc. Because of legacy coding issues, I would prefer not to pass the column list as a parameter. The information_schema.columns view contains all the of the columns for the regular tables in the database. Is there a similar listing of the columns for global temp tables that I can query?
Thanks in advance
June 12, 2008 at 12:00 pm
Just look in the TempDB database:
CREATE TABLE ##tmpMyTable (FieldA INT, FieldB VARCHAR(10))
SELECT * FROM TempDB.Information_Schema.Columns WHERE Table_Name = '##tmpMyTable'
June 12, 2008 at 12:03 pm
TYVM! :w00t:
I had found references to tmpDB and the temp database but neither of those seemed to work.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply