• Micke Schonning (11/9/2008)


    The function CombineGroupNames() can be optimzed using this concat-logic:

    DECLARE @Groups VarChar(MAX)

    SELECT @groups = coalesce(@groups +'|' + G.GroupName. G.GroupName)

    FROM Resource R

    INNER JOIN ResourceSecurityGroup RG

    ON R.ResourceID = RG.ResourceID

    INNER JOIN SecurityGroup G

    ON G.GroupID = RG.GroupID

    WHERE R.ResourceID = @ResourceID

    RETURN @Groups

    /Mike

    Thank Mike. I am still new to articles; I don't think I can make adjustment. But this is very helpful hint thanks :).

    [font="Arial"]---

    Mohit K. Gupta, MCITP: Database Administrator (2005), My Blog, Twitter: @SQLCAN[/url].
    Microsoft FTE - SQL Server PFE

    * Some time its the search that counts, not the finding...
    * I didn't think so, but if I was wrong, I was wrong. I'd rather do something, and make a mistake than be frightened and be doing nothing. :smooooth:[/font]

    How to ask for help .. Read Best Practices here[/url].