时间:2021-07-01 10:21:17 帮助过:52人阅读
查询数据库中某个表的字段明细及字段的说明。 显示下图中的字段及说明: 脚本如下:SQL2008R2上测试通过。 ( 50 ) table_name ,column_basic.column_name ,column_default ,is_nullable ,data_type ,character_maximum_length ,column_explain ,(column_key.
查询数据库中某个表的字段明细及字段的说明。
显示下图中的字段及说明:
脚本如下:SQL2008R2上测试通过。
(50) table_name ,column_basic.column_name ,column_default ,is_nullable ,data_type ,character_maximum_length ,column_explain ,(column_key.column_name, ( select table_name,column_name ,column_default ,is_nullable ,data_type ,character_maximum_length,ordinal_position from INFORMATION_SCHEMA.COLUMNS where table_name = @table_name ) column_basic left join ( SELECT objname as column_name,value as column_explain ,,,,default) ) column_explain on column_basic.column_name COLLATE Chinese_PRC_CI_AS = column_explain.column_name COLLATE Chinese_PRC_CI_AS left join ( select column_name from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where table_name = @table_name ) column_key on column_basic.column_name COLLATE Chinese_PRC_CI_AS = column_key.column_name COLLATE Chinese_PRC_CI_AS order by ordinal_position ,美国空间,香港虚拟主机,虚拟主机