Temporary table creations in database

By | November 23, 2016

DB2 temporary table creation

CREATE GLOBAL TEMPORARY TABLE TEMPPROD
  (SERIALNO     CHAR(8)     NOT NULL,
   DESCRIPTION  VARCHAR(60) NOT NULL,
   MFGCOSTAMT   DECIMAL(8,2)        ,
   MFGDEPTNO    CHAR(3)             ,
   MARKUPPCT    SMALLINT            ,
   SALESDEPTNO  CHAR(3)             ,
   CURDATE      DATE        NOT NULL);

http://www.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/intro/src/tpc/db2z_creationoftemporarytables.html

Postgresql temporary table creation

Example:

   CREATE TEMPORARY TABLE temp_location
   (
      city VARCHAR(80),
      street VARCHAR(80)
   ) 
   ON COMMIT DELETE ROWS;

http://www.sqlines.com/postgresql/statements/create_temporary_table

Oracle temporary table creation

CREATE GLOBAL TEMPORARY TABLE my_temp_table (
  id           NUMBER,
  description  VARCHAR2(20)
)
ON COMMIT DELETE ROWS;

https://oracle-base.com/articles/misc/temporary-tables

SQL Server temporary table creation

Local:

CREATE TABLE #LocalTempTable(
UserID int,
UserName varchar(50), 
UserAddress varchar(150))

Global:

CREATE TABLE ##NewGlobalTempTable(
UserID int,
UserName varchar(50), 
UserAddress varchar(150))

http://www.codeproject.com/Articles/42553/Quick-Overview-Temporary-Tables-in-SQL-Server

 

Leave a Reply

Your email address will not be published. Required fields are marked *