Search code examples
tempdbsybase-asa

How to insert into a temporary table?


I'm working with Sybase Central using Adaptive Server Anywhere 9 and I want some examples of how to use tempDB.

How can I insert some records in to a temporary table?

I tried:

select * into TempDB.dba.#testing from testTable

But I got the following error:

Syntax error near '.' on line 1


Solution

  • There are two sets of temp tables and you have mixed them up

    1) Session related there are access as #table ie

    select * into #testing from testTable
    

    This lasts as long as your connection

    2) tables in tempdb. These persist until the server gets rebooted.

    select * into TempDB.testing from testTable
    

    See sybase docs for more info ASE