Table Details in SQL Anywhere?
Asked Answered
P

11

15

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)?

Pleiades answered 25/2, 2009 at 9:46 Comment(1)
I got answer to part of my question regarding table details here: #101004 But still I don't know how to find the list of tables. I have got an idea though, let me try :)Pleiades
A
14

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

Anibalanica answered 25/2, 2009 at 9:53 Comment(0)
F
9
select * from systable  // lists all tables
select * from syscolumn // lists all tables columns
Frenzy answered 25/3, 2009 at 17:29 Comment(0)
G
4

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

Garibald answered 23/5, 2009 at 7:56 Comment(0)
G
1

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).

Gorilla answered 14/3, 2009 at 8:57 Comment(0)
B
1
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.

Brittain answered 23/4, 2011 at 22:53 Comment(0)
M
1

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)
Moynahan answered 20/11, 2013 at 21:42 Comment(0)
S
0

System proc, sa_describe_query is quite useful

SELECT * FROM sa_describe_query('select * from TableName')

Semester answered 29/3, 2012 at 10:58 Comment(0)
R
0

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'
Ratepayer answered 9/8, 2012 at 15:10 Comment(0)
L
0

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

Linearity answered 22/9, 2016 at 18:44 Comment(0)
R
-1

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;
Rhododendron answered 29/10, 2014 at 12:4 Comment(0)
P
-1

select * from user_tables;

desc tablename;

Phiz answered 11/11, 2014 at 8:49 Comment(1)
That is not valid for SQL Anywhere.Vigorous

© 2022 - 2024 — McMap. All rights reserved.