F fcy123 Unregistered / Unconfirmed GUEST, unregistred user! 2007-04-27 #1 在存储过程中如何判断一个临时表的内容是否不为空<br>存储过程<br><br>select * into #temp from table where id>30<br><br>if #temp的内容为空的话就不进行其它操作了,怎样判断呢?
在存储过程中如何判断一个临时表的内容是否不为空<br>存储过程<br><br>select * into #temp from table where id>30<br><br>if #temp的内容为空的话就不进行其它操作了,怎样判断呢?
S songrun Unregistered / Unconfirmed GUEST, unregistred user! 2007-04-27 #2 if not exists(select top 1 * from #temp  {do}<br>else<br> {do}
if not exists(select top 1 * from #temp  {do}<br>else<br> {do}
F fcy123 Unregistered / Unconfirmed GUEST, unregistred user! 2007-04-27 #3 我写的是if exists (select top 1 * from #temptown)<br>do<br>实际结果是记录集为空的时候还是执行其他操作,程序不会出错,但是空的记录集我不想处理了
我写的是if exists (select top 1 * from #temptown)<br>do<br>实际结果是记录集为空的时候还是执行其他操作,程序不会出错,但是空的记录集我不想处理了
F fcy123 Unregistered / Unconfirmed GUEST, unregistred user! 2007-04-27 #5 这个语句也不行<br>if (OBJECT_ID('tempdb..#temp') IS NOT NULL  
这个语句也不行<br>if (OBJECT_ID('tempdb..#temp') IS NOT NULL  
S songrun Unregistered / Unconfirmed GUEST, unregistred user! 2007-04-27 #6 if (select count(*)from temptown where _field is not null)>0
if (select count(*)from temptown where _field is not null)>0