1、获取数据表中的字段名、类型、长度、描述
select name,reftype,length,descrip from (
select distinct A.COLUMN_ID as id, A.column_name name,A.data_type reftype,A.data_length as length,ments descrip
from user_tab_columns A,user_col_comments B ,all_cons_columns C,USER_TAB_COMMENTS D where a.COLUMN_NAME=b.column_name and A.Table_Name = B.Table_Name
and A.Table_Name = D.Table_Name and (A.TABLE_NAME=c.table_name) and A.Table_Name='tablename' ORDER BY id )
2、获取数据表创建语句
schname:模式名 tablename:表名
call SP_TABLEDEF(schname,tablename)
3、获取数据表主键信息
Select col.column_name from all_constraints con,all_cons_columns col where
con.constraint_name=col.constraint_name and con.constraint_type='P' and col.table_name='tablename'
4、获取指定模式下所有用户表信息
select TABLE_NAME as NAME from dba_tables where owner='schemaname'
如果觉得《关于DM达梦数据库 获取用户表信息 数据表结构 数据表创建语句 主键等信息的sql》对你有帮助,请点赞、收藏,并留下你的观点哦!