Как подсчитать результат таблицы и передать в переменную хранимой процедуры?
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
DECLARE @totalCount Int Select @totalCount = count(*) From table1 Exec sp_DoSomething @Var = @totalCount
select @totalrecs= count(id) from table1