cancel
Showing results for 
Search instead for 
Did you mean: 

Temporary table meta data

Former Member
8,290

How can I get temp table meta data as I need to know column names and types. select * from tempdb.sys.syscolumns where tname like '#task' is not working, however #task table is there

reimer_pods
Participant

What type of temporary table is this, how is it created?
- CREATE GLOBAL TEMPORARY TABLE
- CREATE LOCAL TEMPORARY TABLE
- DECLARE LOCAL TEMPORARY TABLE
- SELECT ... INTO #task FROM ...
Which version of SQL Anywhere are you using?

Former Member
0 Kudos

Table was created using create LOCAL

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member

For local temporary tables you may use "select * from sa_describe_query('select * from temp1')". For global temporary table you can pick up the schema from the catalog (e.g syscolumns view).

VolkerBarth
Contributor

Are you using SQL Anywhere at all? AFAIK, the particular "tempdb" database is a particular ASE/MS SQL Server facility to store temporary tables.

SQL Anywhere (SA) has no explicit "tempdb" database, nor does it use the three-part-name schema (database.owner.table). So it seems the

select from tempdb.sys.syscolumns

completely ignores the "database" specifier and is really just a

select from sys.syscolumns

and simply returns alls rows for all permanent tables and for all global temporary tables.

So, if you're using SA, then "#task" will only be in the result set if it is a global temporary table.


FWIW, SA's "temp" dbspace is something completely different...

Former Member
0 Kudos

Creating global temp table works for me as I can get data from sys.syscolumns. Thanks a lot.