Discussion Locked

global temporary tables

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

how do u create global temporary tables with the help of stored procedures. Please provide syntax help to. What is wrong with this syntax please suggest?
"create global temporary table as select * from

on delete commit rows."

5 replies

by andrew

I'm not sure which DBMS you're using, but maybe this MS SQL Server T-SQL example will help.

Global temp tables have the '##' prefix. They can be created explicitly:

CREATE TABLE ##TEMP (F1 int,F2 varchar(20))

of implicitly:

SELECT * INTO##TEMP FROM Table1

I'm not sure what you're trying to do in your example, but this kind of code could easily be called from a DELETE trigger.

by steved

Are you using SQL Server? If so, a global temporary table is created just like any other table. It's distinguished simply by having two pound signs (##) as the first two characters of its name. Syntax examples:

Select *
into ##temptable
from anytable

Create table ##temptable (
Field1 type1,
Field2 type2,
etc.
)

If you're using some other database, then this is probably all wrong. :-)

This discussion is closed to new replies.