文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>判断Table是否存在自增列

判断Table是否存在自增列

时间:2010-09-06  来源:小虞

declare @Table_name varchar(60)

set @Table_name = '';

if Exists(Select top 1 1 from sysobjects
           Where objectproperty(id, 'TableHasIdentity') = 1
             and upper(name) = upper(@Table_name)
         )
     select 1
else select 0

-- or

if Exists(Select top 1 1 from sysobjects so
           Where so.xtype = 'U'
             and upper(so.name) = upper(@Table_name)
             and Exists(Select Top 1 1 from syscolumns sc
                         Where sc.id = so.id
                           and columnproperty(sc.id, sc.name, 'IsIdentity') = 1
                       )
         )
       select 1
else select 0

相关阅读 更多 +
排行榜 更多 +
浴血混战官方下载

浴血混战官方下载

飞行射击 下载
检票员模拟器免广告下载

检票员模拟器免广告下载

模拟经营 下载
最终前哨最终版手机版下载

最终前哨最终版手机版下载

休闲益智 下载