General discussion

Locked

global temporary tables

By anandvp ·
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 <tname> as select * from <table name> on delete commit rows."

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

global temporary tables

by andrew In reply to global temporary tables

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.

Collapse -

global temporary tables

by anandvp In reply to global temporary tables

The question was auto-closed by TechRepublic

Collapse -

global temporary tables

by SteveD In reply to global temporary tables

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. :-)

Collapse -

global temporary tables

by anandvp In reply to global temporary tables

The question was auto-closed by TechRepublic

Collapse -

global temporary tables

by anandvp In reply to global temporary tables

This question was auto closed due to inactivity

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums