Hi all,
I have a stored procdure which does a select and returns the records
directly -i.e. Not in output parameters e.g:
CREATE PROCEDURE up_SelectRecs(@ProductName nvarchar(30)) AS
SELECT *
FROM MyTable
WHERE [Name]=@ProductName
In another stored procedure I need to do the following:
SELECT COUNT(*)
FROM MyTable
WHERE [Name]=@ProductName
As the select queries are actually a lot more complex that this, I'd
rather not duplicate the select code in 2 sp's to save the maintenance
effort - I'm looking for a way to execute the first procedure from the
second and just count the records returned - something like:
SELECT Count(*)
FROM EXEC up_SelectRecs @ProductName
Any way to achieve this?
Thanks all
--James