• WayneS (11/10/2008)


    What I would recommend doing for it though is to instead of using all of the replace statements, is to:

    Yes. The REPLACEs were used because the case where I lifted the code from actually needed to put a prefix on as well as generating the separator, i.e. replace(replace(replace(...,'][',','),'[],'Entries are: '),']',''). You can still dispence with the UDF...ALTER View [dbo].[ApplicationResources]

    AS

    SELECT R.[ResourceName]

    ,R.[IsEnabled]

    ,substring((SELECT '|'+sg.GroupName

    FROM ResourceSecurityGroup rsg

    JOIN SecurityGroup sg ON rsg.GroupID=sg.GroupID

    WHERE rsg.ResourceID=R.ResourceID

    ORDER BY GroupName

    FOR XML PATH('')),2,1000) as 'Groups'

    FROM dbo.Resource R

    go

    Derek