database SQL Anywhere 中的表详细信息?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/585355/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Table Details in SQL Anywhere?
提问by virtualmic
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)?
我刚刚下载了 SQL Anywhere 的开发者版。如何获取我连接到的数据库中的表列表?同样对于特定表,如何获取该表的元数据(列名、类型等)?
采纳答案by Steve Weet
I have not used SQL-Anywhere for many years however the following statement should work
我已经很多年没有使用 SQL-Anywhere了,但是下面的语句应该可以工作
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
这是直接从之前的问题中抄袭的
回答by Zote
select * from systable // lists all tables
select * from syscolumn // lists all tables columns
回答by Vincent Buck
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
将返回表的列,并指示列的类型,是否可以为空和主键
回答by Dansk
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.
这将生成可以访问它们的表和用户的列表。
回答by Breck Carter
Assuming Windows: start - All Programs - SQL Anywhere 11 - Sybase Central
假设 Windows:开始 - 所有程序 - SQL Anywhere 11 - Sybase Central
Then Connections - Connect with SQL Anywhere 11...
然后连接 - 与 SQL Anywhere 11 连接...
Select "ODBC Data Source name" and pick "SQL Anywhere 11 Demo"
选择“ODBC 数据源名称”并选择“SQL Anywhere 11 Demo”
Press OK to see a tree view of the various objects in the database (tables etcetera).
按 OK 以查看数据库中各种对象(表等)的树视图。
回答by MWik
Use this view: http://dcx.sybase.com/1001/en/dbrfen10/rf-syvcol.html
使用此视图: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)
回答by Zilog
System proc, sa_describe_queryis quite useful
系统过程,sa_describe_query很有用
SELECT * FROM sa_describe_query('select * from TableName')
SELECT * FROM sa_describe_query('select * from TableName')
回答by idir.dah
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'
回答by CredoV
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
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
http://dcx.sap.com/1200/en/dbreference_en12/syscolumn345.html
回答by user4161594
To select one table details
选择一张表的详细信息
select * from Table_Name;
To select two different table and Map with id
选择两个不同的表和带有 id 的 Map
select * from Table_1 t1,Table2 t2 where t2.id=ti.id;