SQL Query to get Count within a Stored Proc
- by sia
So i need to figure out how i can get a record count value and use that count as a new value to insert into a table.
Ex: In My Stored Procedure
@Count int
What im looking for
@Count to equal "select top (1) _fieldName from _someTable order by _fieldName Desc"
Finally
insert into _newTable (_fieldName) values (@Count)
End
I dont have to use a variable, just trying to demonstrate what im really trying to do. My SQL knowledge is pretty limited so no laughing, or smirking! ;)