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 に答える