louiswun 发表于 2013-2-5 01:37:16

Oracle,Mysql,SqlServer2000 读取表备注语句

Mysql读取字段备注信息:
select *
from Information_schema.columns
where table_Name='emptest';

select   
    concat(table_name, '.', column_name) as 'foreign key',   
    concat(referenced_table_name, '.', referenced_column_name) as 'references'
from
    information_schema.key_column_usage   
where
    table_schema='$databasename' and
    referenced_table_name is not null;

Oracle读取字段备注信息

select A.column_name 字段名,B.comments 备注   
from user_tab_columns   A,user_col_comments   B   
where A.Table_Name = B.Table_Name and A.Column_Name = B.Column_Name and A.Table_Name='TEST'

sql server读取备注信息
"SELECT o.name as tableName,c.name as columnName,p.value as Description FROM sysproperties p join sysobjects o on o.id=p.id
join syscolumns c on p.id=c.id and p.smallid=c.colid where p.name='MS_Description' and o.name = 'yourtable'order by 1";
页: [1]
查看完整版本: Oracle,Mysql,SqlServer2000 读取表备注语句