SQL函数 exists

if exists(select 1 from sportLog)
begin
print 1
end
else
begin
print 2
end

1.当表中存在数据时

结果为1

2.档表中不存在数据时

结果为2

posted on 2013-08-05 21:21  奋斗的笨小孩  阅读(215)  评论(0编辑  收藏  举报