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 = ' 字段名 ');

原文地址:https://www.cnblogs.com/DataBase-123/p/6768766.html