SQL 判断数据库是否有相关表 字段

--判断数据库是否有相关表

if exists (select 1 from sysobjects where id = object_id(' 表名 ') and type = ' U ' );

 

--判断数据库是否有相关字段

if exists (select 1 from syscolumns where id=OBJECT_ID(' 表名 ') and name = ' 字段名 ');

posted @ 2017-04-26 15:16  Hao0  阅读(267)  评论(0)    收藏  举报