0

我想返回自定义值作为行的值,以防通过执行存储过程未获取任何行 - 有没有办法做到这一点?

4

1 回答 1

0
if 0 = (select count(*) from tbl where conditions)
    select 'None' as s, 0 as n
else
    select s, n from tbl where conditions

如果行是从过程返回的,而不是选择,则执行到临时表中,然后执行相同的练习。像这样:

create table #tmp (s varchar(17), n integer)

insert into #tmp
    execute myproc
于 2010-02-11T01:57:46.650 回答