判断实体表是否存在
if Exists(select top 1 * from sysObjects where Id=OBJECT_ID(channels') and xtype='U') print 'yes' else print 'no'
判断临时表是否存在
if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#TempUsers') and type='U') print 'yes' else print 'no'
判断列是否存在(channelid是否存在于channeld)
if exists(select * from syscolumns where id=object_id('channels') and name='channelid' collate Chinese_PRC_CI_AI_WS) begin print 'yes' end else begin print 'no' end
![](https://www.yangguangdream.com/zb_users/plugin/LazyLoad/usr/loading.gif)
微信扫码查看本文
发表评论