http://dcx.sybase.com/1101/en/dbprogramming_en11/ianywhere-data-sqlanywhere-saconnection-getschem6330755502-0.html
http://razorsql.com/articles/sybase_admin_queries.html
http://infocenter.sybase.com/help/topic/com.sybase.help.sqlanywhere.11.0.0/pdf/dbadmin_en11.pdf
http://www.mono-project.com/docs/database-access/providers/sybase/
https://github.com/mono/old-code
Columns collection
- table_schema (Owner)
- table_name (Table)
- column_name (Column)
- ordinal_position
- column_default
- is_nullable
- data_type
- precision
- scale
- column_size
DataSourceInformation collection
- CompositeIdentifierSeparatorPattern
- DataSourceProductName
- DataSourceProductVersion
- DataSourceProductVersionNormalized
- GroupByBehavior
- IdentifierPattern
- IdentifierCase
- OrderByColumnsInSelect
- ParameterMarkerFormat
- ParameterMarkerPattern
- ParameterNameMaxLength
- ParameterNamePattern
- QuotedIdentifierPattern
- QuotedIdentifierCase
- StatementSeparatorPattern
- StringLiteralPattern
- SupportedJoinOperators
DataTypes collection
- TypeName
- ProviderDbType
- ColumnSize
- CreateFormat
- CreateParameters
- DataType
- IsAutoIncrementable
- IsBestMatch
- IsCaseSensitive
- IsFixedLength
- IsFixedPrecisionScale
- IsLong
- IsNullable
- IsSearchable
- IsSearchableWithLike
- IsUnsigned
- MaximumScale
- MinimumScale
- IsConcurrencyType
- IsLiteralSupported
- LiteralPrefix
- LiteralSuffix
ForeignKeys collection
- table_schema (Owner)
- table_name (Table)
- column_name (Column)
IndexColumns collection
- table_schema (Owner)
- table_name (Table)
- index_name (Name)
- column_name (Column)
- order
Indexes collection
- table_schema (Owner)
- table_name (Table)
- index_name (Name)
- primary_key
- is_unique
MetaDataCollections collection
- CollectionName
- NumberOfRestrictions
- NumberOfIdentifierParts
ProcedureParameters collection
- procedure_schema (Owner)
- procedure_name (Name)
- parmeter_name (Parameter)
- data_type
- parameter_type
- is_input
- is_output
Procedures collection
- procedure_schema (Owner)
- procedure_name (Name)
ReservedWords collection
- reserved_word
Restrictions collection
- CollectionName
- RestrictionName
- RestrictionDefault
- RestrictionNumber
Tables collection
- table_schema (Owner)
- table_name (Table)
- table_type (TableType)
UserDefinedTypes collection
- data_type
- default
- precision
- scale
Users collection
- user_name (UserName)
- resource_auth
- database_auth
- schedule_auth
- user_group
ViewColumns collection
- view_schema (Owner)
- view_name (Name)
- column_name (Column)
Views collection
- view_schema (Owner)
- view_name (Name)
/* C – computed column D – default F – SQLJ function L – log N – partition condition P – Transact-SQL or SQLJ procedure PR – prepare objects (created by Dynamic SQL) R – rule RI – referential constraint S – system table TR – trigger U – user table V – view XP – extended stored procedure */ SELECT * FROM sys.systable SELECT * FROM sysobjects WHERE type = ‘U‘ select * from customer --- 查-詢錶 go SELECT * FROM syscolumns GO SELECT * FROM sysobjects GO SELECT sys.sysuserperm.user_name + ‘.‘ + sys.systable.table_name + ‘.‘ + sys.syscolumn.column_name FROM sys.systable, sys.syscolumn, sys.sysuserperm WHERE sys.systable.table_id = sys.syscolumn.table_id AND sys.systable.creator = sys.sysuserperm.user_id AND sys.sysuserperm.user_name NOT IN ( ‘SYS‘, ‘dbo‘ ) AND sys.systable.table_name NOT LIKE ‘pbcat%‘ ORDER BY sys.sysuserperm.user_name, sys.systable.table_name, sys.syscolumn.column_id GO 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
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.Odbc; using System.Data.SqlClient; namespace SQLanyWhereDemo { /// <summary> /// http://dcx.sybase.com/1101/en/dbprogramming_en11/ianywhere-data-sqlanywhere-saconnection-getschem6330755502-0.html /// </summary> public partial class Form3 : Form { string connectionString = @"DSN=geovindu;UID=dba;PWD=sql;"; /// <summary> /// /// </summary> /// <returns></returns> DataTable setDatat() { DataTable dt = new DataTable(); dt.Columns.Add("id", typeof(int)); dt.Columns.Add("name", typeof(string)); dt.Rows.Add(1, "Procedures"); dt.Rows.Add(2, "DataTypes"); dt.Rows.Add(3, "Foreign Keys"); dt.Rows.Add(4, "Databases"); dt.Rows.Add(5, "DBA"); dt.Rows.Add(6, "Arguments"); dt.Rows.Add(7, "Collection Name"); dt.Rows.Add(8, "DatasourceInformation"); dt.Rows.Add(9, "MetaDataCollections"); dt.Rows.Add(10, "ForeignKeyColumns"); dt.Rows.Add(11, "Functions"); dt.Rows.Add(12, "IndexColumns"); dt.Rows.Add(13, "Indexes"); dt.Rows.Add(14, "PrimaryKeys"); dt.Rows.Add(15, "ReservedWords"); dt.Rows.Add(16, "Restrictions"); dt.Rows.Add(17, "Triggers"); dt.Rows.Add(18, "UDFs"); dt.Rows.Add(19, "UniqueKeys"); dt.Rows.Add(20, "UserPrivileges"); dt.Rows.Add(21, "Users"); dt.Rows.Add(22, "ViewColumns"); //DataTable dt = connection.GetSchema("Tables", strRestricted); dt.Rows.Add(23, "Tables"); dt.Rows.Add(24, "Columns");//表的列的详细,有主键TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,ORDINAL_POSITION,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,NUMERIC_PRECISION,NUMERIC_SCALE,DATETIME_PRECISION,CHARACTER_SET_NAME,COLLATION_NAME,COLUMN_TYPE,COLUMN_KEY,EXTRA,PRIVILEGES,COLUMN_COMMENT dt.Rows.Add(25, "Views"); dt.Rows.Add(26, "Indexes");//表的列 dt.Rows.Add(27, "IndexColumns");//主键 return dt; } /// <summary> /// /// </summary> public Form3() { InitializeComponent(); } /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form3_Load(object sender, EventArgs e) { this.txtConnection.Text = connectionString; this.comboBox1.DataSource = setDatat(); this.comboBox1.DisplayMember = "name"; this.comboBox1.ValueMember = "id"; } /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { using (OdbcConnection connection = new OdbcConnection(connectionString)) { connection.Open(); DataTable dt = connection.GetSchema(this.comboBox1.Text.Trim()); this.dataGridView1.DataSource = dt; } } catch (Exception ex) { ex.Message.ToString(); } } } }