Как я могу считать результат таблицы и передать в Переменную Хранимой процедуры?
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