【发布时间】:2010-03-01 00:51:36
【问题描述】:
如何计算表的结果并传递给存储过程变量?
DECLARE @totalrecs varchar
select count(id) from table1
我想要 totalrecs 变量中的计数记录。
【问题讨论】:
标签: sql sql-server stored-procedures
如何计算表的结果并传递给存储过程变量?
DECLARE @totalrecs varchar
select count(id) from table1
我想要 totalrecs 变量中的计数记录。
【问题讨论】:
标签: sql sql-server stored-procedures
喜欢这个
--will not count NULLS
select @totalrecs= count(id) from table1
--will count NULLS
select @totalrecs= count(*) from table1
【讨论】:
DECLARE @totalCount Int
Select @totalCount = count(*)
From table1
Exec sp_DoSomething @Var = @totalCount
【讨论】:
select @totalrecs= count(id) from table1
【讨论】: