How can I count the result of a table and pass into a Stored Procedure Variable?
DECLARE @totalrecs varchar
select count(id) from table1
I want the count record in the totalrecs variable.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With