How can I calculate the result of a table and go into a stored procedure variable?
DECLARE @totalrecs varchar select count(id) from table1
I need a count entry in the variable totalrecs.
like this
--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