would appreciate some help here.
I have a table Groups and a stored proc as below:
CREATE PROCEDURE dbo.getGroups(
@group_name CHAR(50) = NULL)
if (@group_name = NULL )
select * from Groups order by group_name, group_description
select * from Groups where upper(group_name) like upper(@group_name) order by group_name, group_description
This sp needs to be enhanced to return an additional value by name (is_in_use) including all the above cols, so that users know if group is in use or not.
the way to determine is_in_use is based on sql:
select * from Groups g, groupprofile gp
where gp.prod_group = g.group_name
this should run for each group and if it returns a row (1 or more than 1) - is_in_use should be true, else false..
could you kindly help me with this -- how can I return is_in_use flag for each group from my sp..