2009年6月28日 星期日

@@ROWCOUNT

當查無資料時,視為一種錯誤,或是另一種意義時,可參考@@RWOCOUNT,傳回受到上一個陳述式影響的資料列數目,來採取其它行動。

select @retid = convert(int,state_class_a) from wid_state_def where wid_state_id = @stateid
if @@ROWCOUNT =0 set @retid = -1 else set @retid = isnull(@retid,0)

沒有留言:

張貼留言