如何计算表的结果并将其传递到存储过程变量?
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
关于sql - 将过程选择存储到变量中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2353302/