Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Use select statement to get data from #temp

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2009-09-04 : 15:00:54
I use code below in ASP.NET but got "invalid object..." error:

select * from tempdb.dbo.#temp

(For test, I create #temp and insert data in SQL query window.)

How to fix it?

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2009-09-04 : 15:06:38
temp tables are only in scope of the sql "session" that created it. Don't create temp tables from aspx code.
One solution is to create a stored procedure that does all the data work you are trying to do from your asp.net code and then just call the SP.

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -