SQL Server表存在则进行查重 SQL语句

来源:互联网 发布:淘宝车模店怎么开 编辑:程序博客网 时间:2024/04/29 03:40

2014年10月30日14:31:28

SQL Server表存在则进行查重 SQL语句

if exists (select 1 from sysobjects where name='aa') begin (SELECT count(*) from aa where a = 1 );end

说明:如果表不存在,则不返回结果行;否则返回一条结果行,字段值为条数。


在SQL Server 2008上调试成功。



0 0