Instance.Create Method
SQL Server 2005
Compiles the instance and application metadata and creates instance and application databases.
Namespace: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
The account that you use to create an instance of Notification Services must be a member of the sysadmin fixed server role.
The database and schema in which the Notification Services instance is created is based on the specification of the DatabaseName and SchemaName properties.
To test or deploy an instance of Notification Services, you must perform several additional steps, which are documented in the Deploying an Instance of Notification Services section.
The following examples show how to create, register, and enable an instance of Notification Services:
// Set Database Engine instance and // Notification Services object server = new smo.Server(sqlServer); notificationServices = server.NotificationServices; // Determine if the instance already exists. If so, exit. if (server.NotificationServices.Instances.Contains( instanceName)) { Console.WriteLine("Instance exists and will be deleted."); myInstance = notificationServices.Instances[instanceName]; DeleteInstance(myInstance); } // Call ConfigureInstance method to configure the instance // and define the application(s). myInstance = ConfigureInstance(notificationServices); // Create the instance Console.WriteLine("Creating instance..."); myInstance.Create(); //Optional: Export an Instance Configuration File (ICF) Console.WriteLine("Exporting ICF..."); myInstance.Export(@"C:\NS\Full", true); // Register and enable the instance Console.WriteLine("Registering instance..."); myInstance.RegisterLocal(serviceUserName, servicePassword); Console.WriteLine("Enabling instance..."); myInstance.Enable(); Console.WriteLine("Done.");
Development Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.Target Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.
