informix查询表结构方法有多种,可以通过系统信息表查询,也可以通过系统功能查询
查询系统表存储信息步骤:
登录数据库
dbaccess xxxdb ;
执行查询语句
SELECT c.colname[1,20], c.coltype, c.collength
FROM syscolumns c, systables t
WHERE c.tabid = t.tabid
AND t.tabname = 'xxxTable';
通过系统提供的命令功能查询:
dbaccess - info 查询表信息
dbschema命令导出表结构
SELECT c.colname, c.coltype FROM syscolumns c, systables t WHERE c.tabid = t.tabid AND t.tabname = 'xxxTable'
coltype 字段意义:
0 = CHAR 8 = MONEY
1 = SMALLINT 10 = DATETIME
2 = INTEGER 11 = BYTE
3 = FLOAT 12 = TEXT
4 = SMALLFLOAT 13 = VARCHAR
5 = DECIMAL 14 = INTERVAL
6 = SERIAL 15 = NCHAR
7 = DATE 16 = NVARCHAR
desc tablename;