problem when scripting sps with permissions


When scripting multiple stored procedures (would like be able to use it as a promotion script), into one script,
the "grant" statement is not separated by "go" from the script of the stored procedure itself.
That puts the grant statement into the SP itself...


LizaM wrote Jun 1, 2009 at 2:42 PM

proposed fix :
    void AddLines(StringCollection strings)
        foreach(string s in strings)
            if (s.StartsWith("GRANT"))
                result.Append(System.Environment.NewLine + "GO");

            result.Append(System.Environment.NewLine + s);

            if (s.StartsWith("SET QUOTED_IDENTIFIER") || s.StartsWith("SET ANSI_NULLS"))
                result.Append(System.Environment.NewLine + "GO");

wrote Feb 14, 2013 at 2:07 AM