
CREATE FUNCTION dbo.CSAPP_GET_USER_GROUP(@name VARCHAR(255))
RETURNS VARCHAR(255)
AS
BEGIN

RETURN ( SELECT PK_GROUP FROM dbo.RIGHTS_USER_REL_GROUPS rrg , RIGHTS r  WHERE name = @name AND rrg.PK_USER=r.name
AND r.CSAPP_CCHEQ_PROTOCOL_GROUP=1) 
END

