Reputation: 17
This stored procedure has multiple SELECT
statements - I need to write a condition based on one SELECT
statement results among them without altering the stored procedure:
CREATE PROC Test
AS
BEGIN
SELECT 1 AS ID
FROM EMPLOYEE
SELECT NAME, ADDRESS, STATE
FROM EMPLOYEE --NEED TO TAKE ROW COUNT
END
After executing the stored procedure, I'll get 2 result sets. But I need to row count of 2nd select statement, without altering the stored procedure.
Based on that rowcount, I need to work further.
Upvotes: 0
Views: 656
Reputation: 1454
exec Test
select @@rowcount
In this case, @@rowcount will always return last result set row count.
Upvotes: 2