0

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

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
Sjemmie
  • 1,249
  • 8
  • 26
  • 31

1 Answers1

1

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

mmmmmm
  • 32,227
  • 27
  • 88
  • 117
  • select * into TempDB.testing from testTable works ! :) but the table testing doesnt exsist it says. I thought that it would create it automatically . – Sjemmie Feb 09 '10 at 14:06
  • I think I made a typo try TempDB..testing – mmmmmm Feb 09 '10 at 14:39
  • unfortunately,i get the following error again: Syntax error near '.' on line 1 – Sjemmie Feb 09 '10 at 15:57
  • Never mind mark, insert into TempDB.testing(select * from table) also works, thk u very much for the help !! – Sjemmie Feb 10 '10 at 09:06
  • Ah insert into TempDB.testing(select * from table) works if the table already exists select into works if it does not exist – mmmmmm Feb 10 '10 at 12:24