判断表是否为空?

在插入记录之前,需要判断表是否为空,向大侠请教!!
---------------------------------------------------------------

if (select count(*) from table)>0
begin
insert into .................
end
---------------------------------------------------------------

select * from test
if @@rowcount >0
begin
insert test ..........
end
---------------------------------------------------------------

if exists (select * from test)
begin
-----------
end
---------------------------------------------------------------

if (select top 1 id from test) is null
begin

end

Published At
Categories with 数据库类
comments powered by Disqus