标签:obj blog 存在 pre server object cts else logs
1,判断表存在字段(参考:https://www.cnblogs.com/ouyy/p/9202491.html)
IF EXISTS(SELECT 1 FROM SYSOBJECTS so,SYSCOLUMNS sc WHERE so.ID = sc.ID AND so.NAME=‘表名‘ AND sc.NAME=‘字段‘)
IF EXISTS(SELECT 1 FROM syscolumns WHERE id = object_id(‘表名‘) AND name = ‘字段‘)
IF COL_LENGTH(‘表名‘, ‘字段‘) IS NOT NULL PRINT N‘存在‘ ELSE PRINT N‘不存在‘
标签:obj blog 存在 pre server object cts else logs
原文地址:https://www.cnblogs.com/clis/p/12418683.html