public string ScriptAlter(Database db)
{
if (RoutineType != RoutineKind.XmlSchemaCollection) {
var regex = new Regex(SqlCreateRegex, RegexOptions.IgnoreCase);
var match = regex.Match(Text);
var group = match.Groups[1];
if (group.Success) {
return ScriptBase(db, Text.Substring(0, group.Index) + "ALTER" + Text.Substring(group.Index + group.Length));
}
}
throw new Exception(string.Format("Unable to script routine {0} {1}.{2} as ALTER", RoutineType, Owner, Name));
}