Temp Tables

Temp Tables

Post by C.Fleur » Sat, 21 Jul 2001 22:33:16



Hi,

The way temp tables in MS-SQL works won't resolve some of my problems. What
I would like to be able to do, is something like:





Can that be achieved ? How ?

Thanks
C.Fleury

 
 
 

Temp Tables

Post by Zachary Well » Sat, 21 Jul 2001 22:32:33


You have to use EXEC:





Take note though, exec is not optimized and won't run as well as a regular
stored procedure. If its at all possible, I'd try to figure out a way not to
have to use exec.

Zach


> Hi,

> The way temp tables in MS-SQL works won't resolve some of my problems.
What
> I would like to be able to do, is something like:





> Can that be achieved ? How ?

> Thanks
> C.Fleury


 
 
 

Temp Tables

Post by Erland Sommarsko » Mon, 23 Jul 2001 08:28:59


[posted and mailed, please reply in news]


> The way temp tables in MS-SQL works won't resolve some of my problems.

Why not? Or more precisely, what are your actual problem? If you present
that, you might be lucky to get a suggestion for a good solution.

One common misconception is that that names of temp tables are not
unique. Of course most SQL developers knows that #tmp behind the
scenes are something else, and one user's #tmp is another user's
#tmp, but I like to mention this just in case.

One common approach when you cannot use temp tables because you access
them from a client and use disconnected record sets, is to have a
permanent table, of which the first key column is a client-key assigned
in some way.

--
Erland Sommarskog, Abaris AB

SQL Server MVP

 
 
 

1. Temp table vs Global Temp table

I think this is a very simple question, however, I don't know the
answer.  What is the
difference between a regular Temp table and a Global Temp table?  I need
to create
a temp table within an sp that all users will use.  I want the table
recreated each
time someone accesses the sp, though, because some of the same info may
need
to be inserted and I don't want any PK errors.

thanks!!
Toni Eibner

2. Database locked by another user

3. temp table in temp dbspace

4. ODBC, Server Classes, ING_SET and Locks

5. returning temp result of temp table to ADO/ASP

6. primary key generation and locking

7. temp table problem with global temp option

8. Question on V$SESSION_EVENT??

9. Massive Updates: Temp Or Not Temp Tables?

10. ALTER TABLE on temp tables, table variables

11. Error renaming table file to a temp table table caused ingres to crash

12. Creation of temporary tables in SP, accessing the temp table in ASP

13. temp tables vs table varibles