---1.獲取所有庫名(排除系統庫)
use master ;
select name from sysdatabases where name not in('master','model','msdb','tempdb');
---2.獲取某個庫所有表名(自定義表)
use 數據庫;
select name from sysobjects where xtype='U' ;
注:1.xtype=‘U’表示自定義表;xtype='S'表示系統表;
---3.獲取某個表中所有字段
use 數據庫;
方法1:select name from syscolumns where object_id('表名');
方法2: select column_name FROM information_schema.columns where table_name = '表名';
---4.查詢表中某個字段類型類型或者改字段是否存在
use 數據庫;
select column_name,data_type FROM information_schema.columns where table_name = '表名' and column_name='字段名' ;