I just downloaded the developer edition of SQL Anywhere. How can I get a list of tables in the database I'm connected to?. Also for a particular table, how do I get the meta-data for that table (column names, types, etc)?
-
I got answer to part of my question regarding table details here: http://stackoverflow.com/questions/100504/what-is-the-sql-command-to-return-the-field-names-of-a-table But still I don't know how to find the list of tables. I have got an idea though, let me try :) – virtualmic Feb 25 '09 at 09:54
11 Answers
I have not used SQL-Anywhere for many years however the following statement should work
select c.column_name
from systabcol c
key join systab t on t.table_id=c.table_id
where t.table_name='tablename'
This was cribbed directly from an earlier question

- 1
- 1

- 28,126
- 11
- 70
- 86
select * from systable // lists all tables
select * from syscolumn // lists all tables columns

- 5,343
- 5
- 41
- 43
For a particular table:
describe TableName
will return the table's columns, with an indication of the column's type, whether it's nullable and a primary key

- 16,462
- 2
- 21
- 21
Use this view: http://dcx.sybase.com/1001/en/dbrfen10/rf-syvcol.html
Try
select * from sys.syscolumns
or just tables which you created:
select * from sys.syscolumns where creator=(select current user)

- 103
- 5
Assuming Windows: start - All Programs - SQL Anywhere 11 - Sybase Central
Then Connections - Connect with SQL Anywhere 11...
Select "ODBC Data Source name" and pick "SQL Anywhere 11 Demo"
Press OK to see a tree view of the various objects in the database (tables etcetera).

- 351
- 2
- 5
- 18
To get the list of all tables used in the database :
select * from systable //without 's'
To get the list of all columns :
select * from syscolumn //without 's'

- 1
- 1
select t.table_name, c.column_name, c.base_type_str, c.nulls from systabcol c key join systab t on t.table_id = c.table_id
http://dcx.sap.com/1200/en/dbreference_en12/syscolumn345.html

- 1
- 1
System proc, sa_describe_query is quite useful
SELECT * FROM sa_describe_query('select * from TableName')

- 468
- 3
- 7
To select one table details
select * from Table_Name;
To select two different table and Map with id
select * from Table_1 t1,Table2 t2 where t2.id=ti.id;
select * from user_tables;
desc tablename;