July 21, 2008 at 9:40 am
I've created a temporary table using select into statement, and called the table #Table1 (for example). But I can't get the syntax right to pull the information out of the table.
Select * from [#Table1] doesn't work. How is a temporary table called in queries?
Thanks.
July 21, 2008 at 9:54 am
it sounds like you are doing everything right...
here's a basic example of a select into:
select top 5 * into #Table1 from sysobjects
Select * from [#Table1]
that works fine on my machine...the only thing i can think of that might be a problem is if your server is case sensitive, and you create #table1 but reference #Table1
can you post your actual exact query as an example?
Lowell
July 21, 2008 at 10:02 am
Your statement looks fine, What error are you getting?
Are you able to post your entire query?
July 21, 2008 at 10:57 am
And, perhaps more importantly, are you selecting from the temporary table in the same query (or on the same connection) as you created it?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 21, 2008 at 6:28 pm
lallen (7/21/2008)
I've created a temporary table using select into statement, and called the table #Table1 (for example). But I can't get the syntax right to pull the information out of the table.Select * from [#Table1] doesn't work. How is a temporary table called in queries?
Thanks.
Please post your code... we're just guessing here...
--Jeff Moden
Change is inevitable... Change for the better is not.
July 21, 2008 at 11:01 pm
lallen (7/21/2008)
--------------------------------------------------------------------------------
I've created a temporary table using select into statement, and called the table #Table1 (for example). But I can't get the syntax right to pull the information out of the table.
Select * from [#Table1] doesn't work. How is a temporary table called in queries?
Thanks.
I think, lallen has closed the current session and trying to get the temporary table again by using select statements. it seems like no issues in your query.
but if you have closed the session, then the temporary table will not be available for you..
Cheers!
Sandy.
--
July 22, 2008 at 3:22 am
Sandy (7/21/2008)
lallen (7/21/2008)
--------------------------------------------------------------------------------
I've created a temporary table using select into statement, and called the table #Table1 (for example). But I can't get the syntax right to pull the information out of the table.
Select * from [#Table1] doesn't work. How is a temporary table called in queries?
Thanks.
I think, lallen has closed the current session and trying to get the temporary table again by using select statements. it seems like no issues in your query.
but if you have closed the session, then the temporary table will not be available for you..
Cheers!
Sandy.
Sandy, temp tables are stored in temp database??
July 22, 2008 at 3:30 am
so, what you are trying to say??
Cheers!
Sandy.
--
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply