如何計算表的結果並傳遞到存儲過程變量?存儲過程選擇一個變量
DECLARE @totalrecs varchar
select count(id) from table1
我想要totalrecs變量中的計數記錄。
如何計算表的結果並傳遞到存儲過程變量?存儲過程選擇一個變量
DECLARE @totalrecs varchar
select count(id) from table1
我想要totalrecs變量中的計數記錄。
這樣
--will not count NULLS
select @totalrecs= count(id) from table1
--will count NULLS
select @totalrecs= count(*) from table1
select @totalrecs= count(id) from table1
DECLARE @totalCount Int
Select @totalCount = count(*)
From table1
Exec sp_DoSomething @Var = @totalCount