Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining 2 Stored Procedures into 1 1

Status
Not open for further replies.

solla

Programmer
Feb 21, 2003
19
FR
I have inherited 2 stored procedures from an Access database:

=====SP1
SELECT [ID]
FROM SP2
WHERE (GC=reqGC) And (UC=reqUC);

=====SP2
SELECT [ID], Count([GroupID]) AS GC, Count([UserID]) AS UC
FROM TABLE1
GROUP BY [ID];

Note that SP1 calls SP2.

I am struggling to translate this logic into an SQL Server stored procedure.

Can anyone help me?
 
create procedyre sb_2 (@regCC int, @regUC int)
as
select ID from table1
group by ID
having count(GroupId) = @regCC
and count(UserID) = @regUC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top