I have been looking to use the function ScriptHeader from the class Microsoft.SqlServer.Management.Smo.StoredProcedure
. I found how to do it (was expecting to have a namespace folder there). But I'm just curious to understand the reason why the enum is defined inside a class like it. What is the advantage of doing it that way?
Server ServerConnect = new Server(new ServerConnection("database"));
StoredProcedure proc = ServerConnect.Databases["myDB"].StoredProcedures[0];
string header = proc.ScriptHeader(ScriptNameObjectBase.ScriptHeaderType.ScriptHeaderForCreateOrAlter);
The class definition is :
namespace Microsoft.SqlServer.Management.Smo {
public class ScriptNameObjectBase : NamedSmoObject
{
protected internal ScriptNameObjectBase();
public enum ScriptHeaderType
{
ScriptHeaderForAlter = 0,
ScriptHeaderForCreate = 1,
ScriptHeaderForCreateOrAlter = 2
}
}
}