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 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
select * from systable // lists all tables
select * from syscolumn // lists all tables columns
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
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).
SELECT b.name + '.' + a.name
FROM sysobjects a, sysusers b
WHERE a.type IN ('U', 'S')
AND a.uid = b.uid
ORDER BY b.name, a.name
This will yield a list of tables and users that have access to them.
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)
System proc, sa_describe_query is quite useful
SELECT * FROM sa_describe_query('select * from TableName')
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'
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
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;
© 2022 - 2024 — McMap. All rights reserved.