Sql Server 關於獲取數據庫名,表名及字段名的幾個語句。

所有的庫名
select [name] from master.dbo.sysdatabases where dbid>6

當前庫下的所有表名
use hischeck
select[name]from sysobjects  where  xtype='U'

當前表下的所有字段名
select column_name from information_schema.columns  where   table_name='hcempno'
select column_name from   information_schema.columns   where   table_name='hcempno'   
select [name] from   syscolumns   where   id   =   object_id('hcempno') 

posted on 2006-11-13 08:51  ★金★  阅读(520)  评论(0编辑  收藏  举报

导航