VistaDB 6
VistaDB / Developer's Guide / SQL Reference / Temp Tables / Temp Table Example
In This Topic
    Temp Table Example
    In This Topic
    Temp tables begin with the # symbol, and live for the life of the connection. Once the connection is closed the table is destroyed.
    Temp Table Example
    Copy Code
    PRINT 'Test Temp Table';
    CREATE TABLE #CustomersTemp
       ID int,
       CustomerName varchar(30),
       City varchar(50),
       State varchar(50)
    INSERT INTO #CustomersTemp (ID, CustomerName, City, State)
       SELECT    *
       FROM    customers
       WHERE    state = 'florida';
    declare @temprows int;
    set @temprows = select count(id) from #CustomersTemp;
    print 'Temp table contains';
    print @temprows;
    DROP TABLE #customerstemp; 
    See Also