SQL-NS Reference

SQL Namespace objects are implemented in C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Sqlns.dll and C:\Program Files\Microsoft SQL Server\80\Tools\Binn\Resources\1033\Sqlns.rll. (The resource directory varies depending on the Unicode collation locale for this instance. 1033 is the General Unicode collation.) Visual Basic applications must include a reference to the SQL-NS object to use early binding. The type library is implemented in the resource Library, Sqlns.rll. C++ applications must include Sqlnsx.h, which references Sqlnsdef.h or use the #import directive to import the type library located in the resource file Sqlns.rll. All interfaces described are automation-enabled dual interfaces.


SQL-NS Objects

SQL-NS exposes these objects:

SQLNamespace Object	SQLNamespaceCommands Object
SQLNamespaceCommand Object	SQLNamespaceObject Object


SQLNamespace Object

The SQLNamespace object (in C++ ISQLNamespace) is the main interface and starting point for using SQL-NS objects.

Methods

GetChildrenCount Method	GetSQLDMOObject Method
GetFirstChildItem Method	GetSQLNamespaceObject Method
GetName Method	GetType Method
GetNextSiblingItem Method	Initialize Method
GetParentItem Method	Refresh Method
GetPreviousSiblingItem Method	SetLCID Method
GetRootItem Method


SQLNamespaceCommand Object

The SQLNamespaceCommand object is the interface that implements the commands for a SQLNamespace object, which invokes user interface objects.

Properties

CommandID Property	Name Property
HelpString Property
Methods

Execute Method	ExecuteWithParam Method


SQLNamespaceCommands Object

The SQLNamespaceCommands object is a collection object containing the commands (SQLNamespaceCommand objects) supported by a SQLNamespaceObject object.

Properties

Count Property

Methods

Item Method


SQLNamespaceObject Object

The SQLNamespaceObject object is the interface that represents a Microsoft® SQL Server™ 2000 Enterprise Manager user interface node in the hierarchy of SQL Namespace.

Properties

Commands Property	Name Property
Handle Property	Type Property
Methods

ExecuteCommandByID Method	ExecuteCommandByName Method


SQL-NS Properties

SQL-NS exposes these properties:

CommandID Property	HelpString Property
Commands Property	Name Property
Count Property	Type Property
Handle Property


CommandID Property

The CommandID property returns the SQLNSCommandID value of a SQLNamespaceCommand object. SQLNSCommandID represents the command that invokes a user interface component on a SQLNamespaceObject object.

Applies To

SQLNamespaceCommand Object

Syntax

object.CommandID

Parts

object

Expression that evaluates to an object in the Applies To list

Data Type

SQLNSCommandID

Modifiable

Read-only

Prototype (C/C++)

HRESULT GetCommandID(SQLNSCommandID *pRetVal) = 0;

Remarks

Not all SQLNSCommandID values are valid commands on a particular SQLNamespaceObject object. To verify that a command is valid, you must verify that the command is part of the Commands collection on the SQLNamespace object.


Commands Property

The Commands property returns the SQLNamespaceCommands collection object.

Applies To

SQLNamespaceObject Object

Syntax

object.Commands

Parts

object

Expression that evaluates to an object in the Applies To list

Data Type

SQLNamespaceCommands Object

Modifiable

Read-only

Prototype (C/C++)

HRESULT GetCommands(ISQLNamespaceCommands *pRetVal);


Count Property

The Count property returns the number of SQLNamespaceCommand objects in the SQLNamespaceCommands collection object.

Applies To

SQLNamespaceCommands Object

Syntax

object.Count

Parts

collection

Expression that evaluates to an object in the Applies To list

Data Type

Long

Modifiable

Read-only

Prototype (C/C++)

HRESULT GetCount(long *pRetVal);


Handle Property

The Handle property contains the value of the SQLNamespaceObject object handle.

Applies To

SQLNamespaceObject Object

Syntax

object.Handle

Parts

object

Expression that evaluates to an object in the Applies To list

Data Type

Long

Modifiable

Read-only

Prototype (C/C++)

HRESULT GetHandle(HSQLNSITEM *pRetVal);


HelpString Property

The HelpString property returns a help string for the SQLNamespaceCommand object command.

Applies To

SQLNamespaceCommand Object

Syntax

object.HelpString

Parts

object

Expression that evaluates to an object in the Applies To list

Data Type

String

Modifiable

Read-only

Prototype (C/C++)

HRESULT GetHelpString(BSTR *pRetVal);

Remarks

Because some SQLNSCommandID values are applicable to multiple SQLNamespaceObject objects, the help string return value can be very generic.


Name Property

The Name property returns the descriptive string displayed in the namespace hierarchy of objects and commands.

Applies To

SQLNamespaceCommand Object	SQLNamespaceObject Object
Syntax

object.Name

Parts

object

Expression that evaluates to an object in the Applies To list

Data Type

String

Modifiable

Read-only

Prototype (C/C++)

HRESULT GetName(BSTR *pRetVal);

Remarks

In the case of the SQLNamespaceCommand object, Name returns the name of the command. The value of Name can then be used as the parameter for the ExecuteCommandByName method on the SQLNamespaceObject object. On the SQLNamespaceObject object, it returns the name of the object.


Type Property

The Type property returns the SQLNamespaceObject object type as SQLNSObjectType.

Applies To

SQLNamespaceObject Object

Syntax

object.Type

Parts

object

Expression that evaluates to an object in the Applies To list

Data Type

SQLNSObjectType

Modifiable

Read-only

Prototype (C/C++)

HRESULT GetType(SQLNSObjectType *pRetVal);

Remarks

SQLNSObjectType is an enumeration containing all possible objects.


SQL-NS Methods

SQL-NS exposes these methods:

Execute Method	GetPreviousSiblingItem Method
ExecuteCommandByID Method	GetRootItem Method
ExecuteCommandByName Method	GetSQLDMOObject Method
ExecuteWithParam Method	GetSQLNamespaceObject Method
GetChildrenCount Method	GetType Method
GetFirstChildItem Method	Initialize Method
GetName Method	Item Method
GetNextSiblingItem Method	Refresh Method
GetParentItem Method	SetLCID Method


Execute Method

The Execute method executes the command associated with the SQLNamespaceCommand object related to the user interface component associated with the command.

Applies To

SQLNamespaceCommand Object

Syntax

object.Execute(
[hWnd],
[modality])

Parts

object

Expression that evaluates to an object in the Applies To list

hWnd

Window handle

modality

Modality of the window

Prototype (C/C++)

HRESULT Execute(
long hwnd ,
SQLNSModality modality);

Remarks

The Execute method optionally provides a parent window. By default, the window handle specified in the Initialize method will be used. The modality parameter suggests preference in modality of the user interface. SQL Namespace, due to the modality of a specific user interface component, can overrule the requested modality. If there is no parent window handle specified during the Initialize call and the modality is SQLNamespace_PreferModal, the value of this parameter cannot be NULL.


ExecuteCommandByID Method

The ExecuteCommandByID method executes the command on the SQLNamespaceObject object identified by the CommandID parameter.

Applies To

SQLNamespaceObject Object

Syntax

object.ExecuteCommandByID(
CommandID,
[hWnd],
[modality])

Parts

object

Expression that evaluates to an object in the Applies To list

CommandID

Command ID

hWnd

Parent window handle

modality

Modality of the window

Prototype (C/C++)

HRESULT ExecuteCommandByID(
SQLNSCommandID CommandID,
long hwnd,
SQLNSModality modality);

Remarks

The ExecuteCommandByID method optionally provides a parent window (by default, the parent window handle specified by the Initialize method) and suggests preference in modality of the user interface. ExecuteCommandByID is the preferred method for executing commands, because it is independent of the system language of the computer where the application runs.


ExecuteCommandByName Method

The ExecuteCommandByName method executes the command identified by the bstrCommand parameter.

Applies To

SQLNamespaceObject Object

Syntax

object.ExecuteCommandByName(
bstrCommand As String,
[hWnd] As Long,
[modality] As SQLNSModality)

Parts

object

Expression that evaluates to an object in the Applies To list

bstrCommand

Name of the command

hWnd

Parent window handle

modality

Modality of the window

Prototype (C/C++)

HRESULT ExecuteCommandByName(
BSTR bstrCommand,
long hwnd,
SQLNSModality modality);

Remarks

The ExecuteCommandByName method optionally provides a parent window (by default, the window specified by the Initialize method) and suggests preference in modality of the user interface. Calling ExecuteCommandByName will make an application dependent on the language of the system where the application runs. To avoid this behavior, call ExecuteCommandByID.


ExecuteWithParam Method

The ExecuteWithParam method executes the command associated with the SQLNamespaceCommand object, which is related to the user interface component associated with the command. A parameter can be passed with the command.

Applies To

SQLNamespaceCommand Object

Syntax

object.ExecuteWithParam(
[ hWnd ] ,
[ modality ] ,
[ pVarParam ] )

Parts

object

Expression that evaluates to an object in the Applies To list

hWnd

Long integer that specifies the parent window handle

modality

SQLNSModality constant that indicates modality type as described in Settings

pVarParam

Variant that contains the value to pass as a parameter

Settings

Set modality using these values.

Constant	Value	Description
SQLNamespace_DontCare	0	Default window behavior.
SQLNamespace_PreferModal	1	Modal window behavior (if available).
SQLNamespace_PreferModeless	2	Modeless window behavior (if available).
Prototype (C/C++)

HRESULT ExecuteWithParam(
long hwnd,
SQLNSModality modality,
LPVARIANT pVarParam)

Remarks

The ExecuteWithParam method optionally provides a parent window. By default, the window handle specified in the Initialize method will be used. The modality parameter suggests preference in modality of the user interface. SQL Namespace, due to the modality of a specific user interface component, can overrule the requested modality. If there is no parent window handle specified during the Initialize call and the modality is SQLNamespace_PreferModal, the value of this parameter cannot be NULL.

ExecuteWithParam extends the functionality of the Execute method by allowing an application to pass a parameter in the optional pVarParam parameter.


GetChildrenCount Method

The GetChildrenCount method retrieves the number of child members belonging to an item.

Applies To

SQLNamespace Object

Syntax

object.GetChildrenCount(
ItemIn)

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

Data Type

Long

Prototype (C/C++)

HRESULT GetChildrenCount(
HSQLNSITEM ItemIn,
long *pRetVal);


GetFirstChildItem Method

The GetFirstChildren method retrieves the first child item, relative from the item in the SQL Namespace hierarchy, and optionally matchesthe object type or object name.

Applies To

SQLNamespace Object

Syntax

object.GetFirstChildItem(
ItemIn ,
[matchType] ,
[matchName])

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

matchType

Object type to match

matchName

Object name to match

Data Type

Long

Prototype (C/C++)

HRESULT GetFirstChildItem(
HSQLNSITEM ItemIn,
SQLNSObjectType matchType,
BSTR matchName,
HSQLNSITEM *pItemOut);


GetName Method

The GetName method retrieves the name of a member item.

Applies To

SQLNamespace Object

Syntax

object.GetName(
ItemIn)

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

Data Type

String

Prototype (C/C++)

HRESULT GetName(
HSQLNSITEM ItemIn,
BSTR *pRetVal);


GetNextSiblingItem Method

The GetNextSiblingItem method retrieves the next sibling item, optionally matching the object type or object name.

Applies To

SQLNamespace Object

Syntax

object.GetNextSiblingItem(
ItemIn ,
[matchType] ,
[matchName])

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

matchType

Object type to match

matchName

Object name to match

Data Type

Long

Prototype (C/C++)

HRESULT GetNextSiblingItem(
HSQLNSITEM ItemIn,
SQLNSObjectType matchType,
BSTR matchName,
HSQLNSITEM *pItemOut);


GetParentItem Method

The GetParentItem method retrieves the parent item.

Applies To

SQLNamespace Object

Syntax

object.GetParentItem(
ItemIn)

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

Data Type

Long

Prototype (C/C++)

HRESULT GetParentItem(
HSQLNSITEM ItemIn,
HSQLNSITEM *pItemOut);


GetPreviousSiblingItem Method

The GetPreviousSiblingItem method retrieves the previous sibling item, optionally matching the object type or object name.

Applies To

SQLNamespace Object

Syntax

object.GetPreviousSiblingItem(
ItemIn ,
[matchType] ,
[matchName])

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

matchType

Object type to match

matchName

Object name to match

Data Type

Long

Prototype (C/C++)

HRESULT GetPreviousSiblingItem(
HSQLNSITEM ItemIn,
SQLNSObjectType matchType,
BSTR matchName,
HSQLNSITEM *pItemOut);


GetRootItem Method

Retrieves the handle to the root item in the Namespace hierarchy. The root item is defined by the Initialize method.

Applies To

SQLNamespace Object

Syntax

object.GetRootItem()

Parts

object

Expression that evaluates to an object in the Applies To list

Data Type

Long

Prototype (C/C++)

HRESULT GetRootItem(
HSQLNSITEM *pItemOut);


GetSQLDMOObject Method

The GetSQLDMOObject method retrieves the SQL-DMO object associated with this item.

Applies To

SQLNamespace Object

Syntax

object.GetSQLDMOObject(
ItemIn)

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

Data Type

Object

Prototype (C/C++)

HRESULT GetSQLDMOObject(
HSQLNSITEM ItemIn,
IDispatch **pRetVal);

Remarks

Not all items have associated SQL-DMO objects. If you want strong type checking for the SQL-DMO objects in Microsoft® Visual Basic®, reference the Microsoft SQL-DMO Object Library. To validate that the object type returned is correct, use the TypeOf method that every SQL-DMO object exposes. TypeOf returns a member of the SQLDMO_OBJECT_TYPE enumeration. If no object is associated with the SQLNamespace object, an empty object is returned (Object Is Nothing). In C++, use the IID_IV* (OLE Automation (VB/VBA) Dual Interfaces) instead of the IID_IW* - C++ Unicode interfaces, because the GetSQLDMOObject method returns an IDispatch pointer. Only the SQL-DMO SQLServer and Database objects are returned.


GetSQLNamespaceObject Method

The GetSQLNamespaceObject method retrieves the namespace interface for the item.

Applies To

SQLNamespace Object

Syntax

object.GetSQLNamespaceObject(
ItemIn)

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

Data Type

SQLNamespaceObject

Prototype (C/C++)

HRESULT GetSQLNamespaceObject(
HSQLNSITEM ItemIn,
ISQLNamespaceObject **pRetVal);


GetType Method

Retrieves the object type (SQLNSObjectType) of the item.

Applies To

SQLNamespace Object

Syntax

object.GetType(
ItemIn)

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

Data Type

SQLNSObjectType

Prototype (C/C++)

HRESULT GetType(
HSQLNSITEM ItemIn,
SQLNSObjectType *pRetVal);


Initialize Method

The Initialize method initializes the namespace, providing the name of client application.

Applies To

SQLNamespace Object

Syntax

object.Initialize(
bstrAppName ,
[rootType] ,
[pRootInfo] ,
[hWnd])

Parts

object

Expression that evaluates to an object in the Applies To list

bstrAppName

Name of the client application

rootType

Type of object to set as root

pRootInfo

Root information

hWnd

Window handle

Remarks

Optionally, provides the default parent window for the user interface, and also a nondefault root of the namespace. For more information about the connectstring, see Programming SQL-NS Applications.

Prototype (C/C++)

HRESULT Initialize(
BSTR bstrAppName,
SQLNSRootType rootType,
VARIANT * pvarRootInfo,
long hWnd);


Item Method

The Item method returns the SQLNamespaceCommand object in the collection based on the specified index parameter.

Applies To

SQLNamespaceCommands Object

Syntax

object.Item(
Index)

Parts

object

Expression that evaluates to an object in the Applies To list

Index

Order of an object in the SQLNamespaceCommands collection

Data Type

SQLNamespaceCommand

Prototype (C/C++)

HRESULT Item(
ISQLNamespaceCommand *pRetVal);

Remarks

The index is 1-based.


Refresh Method

The Refresh method refreshes the console tree under the specified node.

Applies To

SQLNamespace Object

Syntax

object.Refresh(ItemIn)

Parts

object

Expression that evaluates to an object in the Applies To list

ItemIn

Handle to the item in the namespace hierarchy

Data Type

None

Prototype (C/C++)

HRESULT Refresh(
HSQLNSITEM ItemIn);


SetLCID Method

The SetLCID method sets the locale ID for SQL Namespace.

Applies To

SQLNamespace Object

Syntax

object.SetLCID(
lLCID)

Parts

object

Expression that evaluates to an object in the Applies To list

lLCID

Locale ID of SQL Namespace

Data Type

None

Prototype (C/C++)

HRESULT SetLCID(
long lcid);


SQL-NS Constants

Enumerated data types are package constants defined in Sqlns.rll. They are used as parameters and return values in SQL-NS package properties and methods.

SQL-NS exposes these constants:

SQLNSCommandID	SQLNSObjectType
SQLNSErrors	SQLNSRootType
SQLNSModality


SQLNSCommandID

SQLNSCommandID constants specify SQL-NS command IDs available in the SQLNamespace object.

Constant	Value	Command
SQLNS_CmdID_AGENT_ERROR_DETAILS	76	Error Details Opens the Agent Error Details dialog box for the specified replication agent.
SQLNS_CmdID_AGENT_HISTORY	77	Agent History Opens the Agent History dialog box for the specified replication agent.
SQLNS_CmdID_DATABASE_BACKUP	80	Back up Database Opens the SQL Server Backup dialog box.
SQLNS_CmdID_DATABASE_RESTORE	81	Restore Database Opens the Restore Database dialog box.
SQLNS_CmdID_DATABASE_SHRINKDB	82	Shrink Database Opens the Shrink Database dialog box.
SQLNS_CmdID_DEFECT	56	Defect.
SQLNS_CmdID_DELETE	17	Delete Deletes the specified item.
SQLNS_CmdID_DTS_EXPORT	60	Data Export Starts the DTS Export Wizard.
SQLNS_CmdID_DTS_IMPORT	59	Data Import Starts the DTS Import Wizard.
SQLNS_CmdID_DTS_RUN	61	Run Package Executes a DTS package.
SQLNS_CmdID_EDIT_SERVER	43	Edit Server Registration dialog box.
SQLNS_CmdID_ENLIST	55	Enlist Starts the Make This a Target Server Wizard.
SQLNS_CmdID_ENLIST_REG_SERVERS	62	Enlist Registered Servers.
SQLNS_CmdID_EXPORT_JOB	57	Generates a script file for the selected Microsoft® SQL Server™ 2000 Agent job.
SQLNS_CmdID_GENERATE_SCRIPTS	79	Generate Scripts Opens the Generate SQL Scripts dialog box.
SQLNS_CmdID_JOB_HISTORY	40	Displays the job history information for a selected SQL Server Agent job.
SQLNS_CmdID_JOB_PROPERTIES (was SQLNS_CmdID_JOB_STEPS)	48	Displays the property dialog box for a selected SQL Server Agent job.
SQLNS_CmdID_JOB_START	39	Starts a selected SQL Server Agent job.
SQLNS_CmdID_JOB_STOP	41	Stops the selected SQL Server Agent job, if currently running.
SQLNS_CmdID_JOBSERVER_ERRORLOG	38	Display Error log Opens the SQL Server Agent Error Log dialog box.
SQLNS_CmdID_JOBSERVER_TARGET_SERVERS	42	Target Servers Opens the Target Servers dialog box.
SQLNS_CmdID_MULTI_SERVER_JOB_STATUS	58	Reserved.
SQLNS_CmdID_NEW_ALERT	20	New Alert Opens the New Alert Properties dialog box.
SQLNS_CmdID_NEW_BACKUPDEVICE	36	New Backup Device Opens the Backup Device Properties - New Device dialog box.
SQLNS_CmdID_NEW_DATABASE	23	New Database Opens the Database Properties dialog box.
SQLNS_CmdID_NEW_DATABASE_ROLE	33	New Database Role Opens the Database Role Properties - New Role dialog box.
SQLNS_CmdID_NEW_DBUSER	35	New Database User Opens the Database User Properties - New User dialog box.
SQLNS_CmdID_NEW_DEFAULT	29	New Default Opens the Default Properties dialog box.
SQLNS_CmdID_NEW_DIAGRAM	32	Does not display a dialog box (internal use only).
SQLNS_CmdID_NEW_EXTENDED_STORED_PROCEDURE	27	Add extended stored procedure (master only).
SQLNS_CmdID_NEW_JOB	19	Add new SQL Server Agent job.
SQLNS_CmdID_NEW_LOGIN	34	New Login.
SQLNS_CmdID_NEW_OPERATOR	21	New Operator Opens the New Operator Properties dialog box.
SQLNS_CmdID_NEW_PUBLICATION	69	New Publication Starts the Create Publication Wizard.
SQLNS_CmdID_NEW_REMOTE_SERVER	22	Add Remote Server.
SQLNS_CmdID_NEW_RULE	28	New Rule Opens the Rule Properties dialog box.
SQLNS_CmdID_NEW_SERVER	18	Add Server to a Server Group (only on default root or server group root level).
SQLNS_CmdID_NEW_SERVER_GROUP	31	New Server Group (only on default_root root level).
SQLNS_CmdID_NEW_STORED_PROCEDURE	26	New Stored Procedure Opens the Stored Procedure Properties - New Stored Procedure dialog box.
SQLNS_CmdID_NEW_SUBSCRIPTION	72	New Pull Subscription Starts the Pull Subscription Wizard.
SQLNS_CmdID_NEW_TABLE	24	Does not display a dialog box (internal use only).
SQLNS_CmdID_NEW_TRACE	86	New trace
SQLNS_CmdID_NEW_UDDT	30	New User Defined Data Type Opens the User-Defined Data Type Properties dialog box.
SQLNS_CmdID_NEW_UDF	85	New user-defined function
SQLNS_CmdID_NEW_VIEW	25	Does not display a dialog box (internal use only).
SQLNS_CmdID_OBJECT_DEPENDENCIES	45	Object Dependencies Opens the Dependencies dialog box.
SQLNS_CmdID_OBJECT_PERMISSIONS	44	Object Permissions Opens the Object Permissions dialog box.
SQLNS_CmdID_OPEN	37	Does not display a dialog box (internal use only).
SQLNS_CmdID_PROPERTIES	16	Properties Opens the Properties dialog box for the specified item.
SQLNS_CmdID_PUBLISHING_PROPERTIES	83	Publishing and Distribution Properties.
SQLNS_CmdID_PUSH_NEW_SUBSCRIPTION	70	New Pull Subscription Starts the Pull Subscription Wizard.
SQLNS_CmdID_REINIT_SUBSCRIPTION	73	Reinitialize Reinitializes a subscription.
SQLNS_CmdID_REPLICATION_CONFIGURE	65	Configure Publishing and Distribution Starts the Configure Publishing and Distribution Wizard.
SQLNS_CmdID_REPLICATION_SUBSCRIBE	66	Pull Subscription Opens the Pull Subscription dialog box.
SQLNS_CmdID_REPLICATION_UNINSTALL	68	Disable Publishing or Distribution.
SQLNS_CmdID_REPLICATION_PUBLISH	64	Publish and Push Subscription Opens the Create and Manage Publications dialog box.
SQLNS_CmdID_REPLICATION_RESOLVE_CONFLICTS	71	Resolve Conflicts.
SQLNS_CmdID_REPLICATION_SCRIPT	67	Create Replication Script.
SQLNS_CmdID_SECURITY_LIST	78	Manage SQL Server Security Opens the SQL Server Security dialog box.
SQLNS_CmdID_SERVER_CONFIGURATION	54	Does not display a dialog box (internal use only).
SQLNS_CmdID_SERVER_CONNECT	53	Reserved.
SQLNS_CmdID_SERVER_SECURITY	52	Server Security Starts the Create Login Wizard.
SQLNS_CmdID_STOP_SYNCHRONIZING	75	Stop Synchronizing Immediately stops synchronization of a subscription.
SQLNS_CmdID_SVC_PAUSE	50	Pause Service Pauses the specified service.
SQLNS_CmdID_SVC_START	51	Start Service Starts the specified service.
SQLNS_CmdID_SVC_STOP	49	Stop Service Stops the specified service.
SQLNS_CmdID_SYNCHRONIZE_NOW	74	Synchronize Now Immediately synchronizes a subscription.
SQLNS_CmdID_TABLE_INDEXES	46	Manage Indexes Opens the Manage Indexes dialog box.
SQLNS_CmdID_TABLE_TRIGGERS	47	Manage Triggers Opens the Trigger Properties dialog box.
SQLNS_CmdID_TOOLS_MAINT_PLAN	63	Database Maintenance Plan Starts the Database Maintenance Plan Wizard.
SQLNS_CmdID_WIZARD_INDEXTUNING	9	Index Tuning Wizard Starts the Index Tuning Wizard.
SQLNS_CmdID_WIZARD_ALERT	10	Create Alert Wizard Starts the Create Alert Wizard.
SQLNS_CmdID_WIZARD_BACKUP	13	Backup Wizard Starts the Create Database Backup Wizard.
SQLNS_CmdID_WIZARD_CREATEDB	1	Create Database Wizard Starts the Create Database Wizard.
SQLNS_CmdID_WIZARD_CREATEINDEX	2	Create Index Wizard Starts the Create Index Wizard.
SQLNS_CmdID_WIZARD_CREATEJOB	5	Create Job Wizard Starts the Create Job Wizard.
SQLNS_CmdID_WIZARD_CREATETRACE	14	Create Trace Wizard Starts the Create Trace Wizard.
SQLNS_CmdID_WIZARD_DTSEXPORT	4	Data Export Wizard Starts the DTS Export Wizard.
SQLNS_CmdID_WIZARD_DTSIMPORT	3	Data Import Wizard Starts the DTS Import Wizard.
SQLNS_CmdID_WIZARD_MAINTPLAN	11	Database Maintenance Plan Wizard Starts the Database Maintenance Plan Wizard.
SQLNS_CmdID_WIZARD_SECURITY	6	Security Wizard Starts the Create Login Wizard.
SQLNS_CmdID_WIZARD_SP	7	Create Stored Procedure Wizard Starts the Stored Procedure Wizard.
SQLNS_CmdID_WIZARD_VIEW	8	Create View Wizard Starts the Create View Wizard.
SQLNS_CmdID_WIZARD_WEBASST	12	Web Assistant Wizard Starts the Web Assistant Wizard.
SQLNS_CmdID_WIZARDS	15	Wizards Opens the Select Wizard dialog box.


SQLNSErrors

SQLNSErrors constants specify error ranges available to the SQLNamespace object.

Constant	Value	Description
SQLNS_E_Already_Initialized	1005	Initialize method was called more than one time.
SQLNS_E_DatabaseNotFound	1019	Specified database was not found.
SQLNS_E_ExternalError	1100	Error outside the scope of SQL-NS and SQL-DMO occurred.
SQLNS_E_InvalidCommandID	1011	Invalid command ID was specified in a call to ExecuteCommandByID.
SQLNS_E_InvalidCommandName	1010	Invalid command name was specified in a call to ExecuteCommandByName.
SQLNS_E_InvalidConnectString	1016	Connection string is invalid.
SQLNS_E_InvalidDBName	1015	Database name is invalid.
SQLNS_E_InvalidLoginInfo	1014	Login information is invalid.
SQLNS_E_InvalidObjectHandle	1008	Object handle is invalid due to specifying an invalid relationship or passing a null pointer.
SQLNS_E_InvalidRootInfo	1012	Connection string does not match with the root object specified.
SQLNS_E_InvalidRootType	1006	Nonmember of the current root type was specified.
SQLNS_E_InvalidServerName	1013	Invalid server name specified.
SQLNS_E_InvalidServerVersion	1020	Server specified must be running SQL Server 7.0.
SQLNS_E_NameDup	1004	Reserved.
SQLNS_E_NameNotFound	1003	Command name was not found in a call to ExecuteCommandByName.
SQLNS_E_NoDMOObject	1009	There is no underlying SQL-DMO object
SQLNS_E_NotImplemented	1001	SQL Namespace object not implemented.
SQLNS_E_OrdOutOfRange	1002	Call was made into a .dll where the ordinal does not exist.
SQLNS_E_RequireAppName	1007	Application name is required in a call to Initialize.
SQLNS_E_ServerNotFound	1018	Server name was not found when specifying SQLNSRootType_Server.
SQLNS_E_SrvGrpNotFound	1017	Server group was not found when specifying SQLNSRootType_ServerGroup.


SQLNSModality

SQLNSModality constants set the modality of the user interface component displayed.

Constant	Value	Description
SQLNamespace_DontCare	0	Default window behavior.
SQLNamespace_PreferModal	1	Modal window behavior if available.
SQLNamespace_PreferModeless	2	Modeless window behavior if available.


SQLNSObjectType

SQLNSObjectType constants specify object type definitions.

Constant	Value	Description
SQLNSOBJECTTYPE _DATABASE	5	Specific database, SQLNSRootType_Server\Databases\master.
SQLNSOBJECTTYPE_ALERT	58	SQLNSRootType_Server\Management\SQL Server Agent\Alerts\Demo: Full msdb log.
SQLNSOBJECTTYPE_ALERTS	47	SQLNSRootType_Server\Management\SQL Server Agent\Alerts.
SQLNSOBJECTTYPE_BACKUPDEVICE	12	Specific backup device.
SQLNSOBJECTTYPE_BACKUPDEVICES	11	Backup Devices.
SQLNSOBJECTTYPE_CURRENTACTIVITY	95	SQLNSRootType_Server\Management\Current Activity.
SQLNSOBJECTTYPE_CURRENTACTIVITY_LOCKEDOBJECT	101	SQLNSRootType_Server\Management\Current Activity\Locks\Object\master.
SQLNSOBJECTTYPE_CURRENTACTIVITY_LOCKEDOBJECT_INFO	102	SQLNSRootType_Server\Management\Current Activity\Locks\Object\master\1.
SQLNSOBJECTTYPE_CURRENTACTIVITY_LOCKEDOBJECTS	100	SQLNSRootType_Server\Management\Current Activity\Locks\Object.
SQLNSOBJECTTYPE_CURRENTACTIVITY_LOGIN	97	Reserved.
SQLNSOBJECTTYPE_CURRENTACTIVITY_PROCESSINFO	98	SQLNSRootType_Server\Management\Current Activity\Process Info.
SQLNSOBJECTTYPE_CURRENTACTIVITY_PROCESSINFO_INFO	99	SQLNSRootType_Server\Management\Current Activity\Process Info\1.
SQLNSOBJECTTYPE_CURRENTACTIVITY_ USERS	96	Reserved.
SQLNSOBJECTTYPE_DATABASE_DEFAULTS	34	Defaults.
SQLNSOBJECTTYPE_DATABASE_DIAGRAM	23	Internal use only, not exposed.
SQLNSOBJECTTYPE_DATABASE_DIAGRAMS	22	Database Diagrams.
SQLNSOBJECTTYPE_DATABASE_EXTENDED_SP	31	Specific extended stored procedure, SQLNSRootType_Server\Databases\master\Extended Stored Procedures\<xp>.
SQLNSOBJECTTYPE_DATABASE_EXTENDED_SPS	30	Extended stored procedure folder, SQLNSRootType_Server\Databases\master\Extended Stored Procedures.
SQLNSOBJECTTYPE_DATABASE_PUBLICATION	14	Specific publication in a database tree.
SQLNSOBJECTTYPE_DATABASE_PUBLICATIONS	13	Publications in a database tree.
SQLNSOBJECTTYPE_DATABASE_DEFAULT	35	Specific default.
SQLNSOBJECTTYPE_DATABASE_PUB_SUBSCRIPTION	15	Specific subscription to a publication in a database tree.
SQLNSOBJECTTYPE_DATABASE_PULL_SUBSCRIPTION	17	Specific pull subscription.
SQLNSOBJECTTYPE_DATABASE_PULL_SUBSCRIPTIONS	16	Pull subscriptions.
SQLNSOBJECTTYPE_DATABASE_ROLE	21	Specific database role.
SQLNSOBJECTTYPE_DATABASE_ROLES	20	Database Roles.
SQLNSOBJECTTYPE_DATABASE_RULE	33	Specific rule.
SQLNSOBJECTTYPE_DATABASE_RULES	32	Rules.
SQLNSOBJECTTYPE_DATABASE_SP	29	Specific stored procedure.
SQLNSOBJECTTYPE_DATABASE_SPS	28	Stored Procedures.
SQLNSOBJECTTYPE_DATABASE_TABLE	25	Specific table.
SQLNSOBJECTTYPE_DATABASE_TABLES	24	Tables.
SQLNSOBJECTTYPE_DATABASE_UDDT	37	Specific user-defined data type.
SQLNSOBJECTTYPE_DATABASE_UDDTS	36	User Defined Data Types.
SQLNSOBJECTTYPE_DATABASE_UDF	102	Specific user-defined function.
SQLNSOBJECTTYPE_DATABASE_UDFS	101	User-defined Functions folder.
SQLNSOBJECTTYPE_DATABASE_USER	19	Specific database user.
SQLNSOBJECTTYPE_DATABASE_USERS	18	Database Users.
SQLNSOBJECTTYPE_DATABASE_VIEW	27	Specific view, SQLNSRootType_Server\Databases\pubs\Views\titleview.
SQLNSOBJECTTYPE_DATABASE_VIEWS	26	SQL Server Views, SQLNSRootType_Server\Databases\pubs\Views.
SQLNSOBJECTTYPE_DATABASES	4	Databases, SQLNSRootType_Server\Databases.
SQLNSOBJECTTYPE_DB_MAINT_PLAN	92	Specific database maintenance plan.
SQLNSOBJECTTYPE_DB_MAINT_PLANS	91	Database Maintenance Plans.
SQLNSOBJECTTYPE_DTC	40	Distributed Transaction Coordinator.
SQLNSOBJECTTYPE_DTS_LOCALPKGS	82	DTS packages saved to Microsoft® SQL Server™ 2000.
SQLNSOBJECTTYPE_DTS_METADATA	86	DTS package meta data folder.
SQLNSOBJECTTYPE_DTS_REPOSPKGS	83	DTS packages saved to repository.
SQLNSOBJECTTYPE_DTSCATEGORIES	85	Reserved.
SQLNSOBJECTTYPE_DTSCATEGORY	85	Reserved.
SQLNSOBJECTTYPE_DTSCONNECTION	90	Reserved.
SQLNSOBJECTTYPE_DTSCONNECTIONS	88	Reserved.
SQLNSOBJECTTYPE_DTSPKG	86	Specific DTS package.
SQLNSOBJECTTYPE_DTSPKGS	83	DTS Packages.
SQLNSOBJECTTYPE_DTSSTEP	89	Reserved.
SQLNSOBJECTTYPE_DTSSTEPS	87	Reserved.
SQLNSOBJECTTYPE_EMPTY	1	Generic object type.
SQLNSOBJECTTYPE_ERRORLOG	45	Specific error log, SQLNSRootType_Server\Management\SQL Server Logs\Current – Date.
SQLNSOBJECTTYPE_ERRORLOGENTRY	46	Error log entry, SQLNSRootType_Server\Management\SQL Server Logs\Current – Date and time.
SQLNSOBJECTTYPE_ERRORLOGS	44	Error log folder, SQLNSRootType_Server\Management\SQL Server Logs.
SQLNSOBJECTTYPE_HETEROGENEOUS_PUB_SUBSCRIPTION	119	Subscription to a heterogeneous publication.
SQLNSOBJECTTYPE_HETEROGENEOUS_PUBLICATION	118	Specific heterogeneous publication.
SQLNSOBJECTTYPE_HETEROGENEOUS_PUBLICATIONS_FOLDER	117	Heterogeneous Publications folder.
SQLNSOBJECTTYPE_HETEROGENEOUS_VENDOR_FOLDER	120	Heterogeneous Vendors folder.
SQLNSOBJECTTYPE_INDEXSERVER	41	Index server catalog.
SQLNSOBJECTTYPE_INDEXSERVER_CATALOGS	42	Index server catalog folder.
SQLNSOBJECTTYPE_INDEXSERVER_CATOLOG	43	Specific index server catalog.
SQLNSOBJECTTYPE_JOBSERVER	38	SQL Server Agent.
SQLNSOBJECTTYPE_LINKEDSERVER	61	Specific linked server, SQLNSRootType_Server\Security\Linked Servers\NWIND.
SQLNSOBJECTTYPE_LINKEDSERVER_TABLE	62	Linked server table, SQLNSRootType_Server\Security\Linked Servers\NWIND\Tables\Categories.
SQLNSOBJECTTYPE_LINKEDSERVER_TABLES	63	Linked server table name, SQLNSRootType_Server\Security\Linked Servers\NWIND\Tables.
SQLNSOBJECTTYPE_LINKEDSERVERS	55	Linked server folder, SQLNSRootType_Server\Security\Linked Servers.
SQLNSOBJECTTYPE_LINKEDSERVER_VIEW	122	Specific linked server view
SQLNSOBJECTTYPE_LINKEDSERVER_VIEWS	121	Linked server views folder.
SQLNSOBJECTTYPE_LOCAL_JOB	52	Specific local job, SQLNSRootType_Server\Management\SQL Server Agent\Jobs\test.
SQLNSOBJECTTYPE_LOCAL_JOBS	50	Local jobs, SQLNSRootType_Server\Management\SQL Server Agent\Jobs.
SQLNSOBJECTTYPE_LOGIN	10	Specific user login.
SQLNSOBJECTTYPE_LOGINS	9	Logins.
SQLNSOBJECTTYPE_LOGSHIPPING_MONITOR	109	Specific Log Shipping monitor.
SQLNSOBJECTTYPE_LOGSHIPPING_MONITORS	108	Log Shipping monitor folder.
SQLNSOBJECTTYPE_MANAGEMENT	6	SQLNSRootType_Server\Management.
SQLNSOBJECTTYPE_MSX_JOBS	49	Reserved.
SQLNSOBJECTTYPE_MULTI_JOB	53	Jobs.
SQLNSOBJECTTYPE_MULTI_JOBS	51	Operators.
SQLNSOBJECTTYPE_OPERATOR	59	Server Roles.
SQLNSOBJECTTYPE_OPERATORS	48	Specific SQL Server log.
SQLNSOBJECTTYPE_PROFILER	103	SQL Server Performance Analysis Traces in the Management folder.
SQLNSOBJECTTYPE_PROFILER_TRACE	104	Reserved.
SQLNSOBJECTTYPE_PUBLICATIONS_FOLDER	111	Publications folder in the Replication folder.
SQLNSOBJECTTYPE_REMOTESERVER	60	Specific server role.
SQLNSOBJECTTYPE_REMOTESERVERS	54	SQLNSRootType_Server\Security\Remote Servers.
SQLNSOBJECTTYPE_REPLICATION	64	Replication folder.
SQLNSOBJECTTYPE_REPLICATION_AGENTS	67	Replication agents folder.
SQLNSOBJECTTYPE_REPLICATION_ALERTS	69	Replication alerts folder.
SQLNSOBJECTTYPE_REPLICATION_DISTRIBUTION_AGENT	78	Specific replication Distribution Agent.
SQLNSOBJECTTYPE_REPLICATION_DISTRIBUTION_AGENTS	74	Replication Distribution Agents folder.
SQLNSOBJECTTYPE_REPLICATION_LOGREADER_AGENT	77	Specific replication Log Reader Agent.
SQLNSOBJECTTYPE_REPLICATION_LOGREADER_AGENTS	73	Replication Log Reader Agents folder.
SQLNSOBJECTTYPE_REPLICATION_MERGE_AGENT	79	Specific replication Merge Agent.
SQLNSOBJECTTYPE_REPLICATION_MERGE_AGENTS	75	Replication Merge Agents folder.
SQLNSOBJECTTYPE_REPLICATION_PUBLICATION	71	Specific replication publication.
SQLNSOBJECTTYPE_REPLICATION_PUBLISHER	66	Specific replication Publisher.
SQLNSOBJECTTYPE_REPLICATION_PUBLISHERS	65	Replication Publishers folder.
SQLNSOBJECTTYPE_REPLICATION_REPORT	80	Reserved.
SQLNSOBJECTTYPE_REPLICATION_REPORTS	68	Reserved.
SQLNSOBJECTTYPE_REPLICATION_SNAPSHOT_AGENT	76	Specific replication Snapshot Agent.
SQLNSOBJECTTYPE_REPLICATION_SNAPSHOT_AGENTS	72	Replication Snapshot Agents folder.
SQLNSOBJECTTYPE_REPLICATION_SUBSCRIPTION	70	Specific replication subscription.
SQLNSOBJECTTYPE_REPLICATION_FOLDER	110	Replication folder.
SQLNSOBJECTTYPE_REPLICATION_FOLDER_PUB_SUBSCRIPTION	114	Specific subscription to a publication in the Publications folder.
SQLNSOBJECTTYPE_REPLICATION_FOLDER_PUBLICATION	113	Specific publication in the Publications folder.
SQLNSOBJECTTYPE_REPLICATION_FOLDER_PUSH_SUBSCRIPTION	116	Specific push subscription in the Subscriptions folder.
SQLNSOBJECTTYPE_REPLICATION_FOLDER_SUBSCRIPTION	115	Specific pull subscription in the Subscriptions folder.
SQLNSOBJECTTYPE_REPLICATION_MONITOR_GROUP	105	Replication monitor group folder.
SQLNSOBJECTTYPE_REPLICATION_QUEUEREADER_AGENT	107	Specific replication Queue Reader Agent.
SQLNSOBJECTTYPE_REPLICATION_QUEUEREADER_AGENTS	106	Replication Queue Reader Agents Folder.
SQLNSOBJECTTYPE_ROOT	0	Generic root node.
SQLNSOBJECTTYPE_SECURITY	7	Security folder SQLNSRootType_Server\Security.
SQLNSOBJECTTYPE_SERVER	3	Server.
SQLNSOBJECTTYPE_SERVER_GROUP	2	Server group.
SQLNSOBJECTTYPE_SERVERROLE	57	Specific remote server.
SQLNSOBJECTTYPE_SERVERROLES	56	Remote server folder, SQLNSRootType_Server\Security\Server Roles.
SQLNSOBJECTTYPE_SERVICES	8	Services folder, SQLNSRootType_Server\Support Services.
SQLNSOBJECTTYPE_SQLMAIL	39	SQL Mail.
SQLNSOBJECTTYPE_SUBSCRIPTIONS_FOLDER	112	Subscriptions folder in the Replication folder.
SQLNSOBJECTTYPE_WEBASSISTANTJOB	94	Specific Web Assistant job.
SQLNSOBJECTTYPE_WEBASSISTANTJOBS	93	Web Assistant Jobs.


SQLNSRootType

SQLNSRootType constants specify the type of object to set as root.

Constant	Value	Description
SQLNSRootType_Database	3	Databases (preferred setting).
SQLNSRootType_DefaultRoot	0	Console tree.
SQLNSRootType_Server	2	Server name (preferred setting).
SQLNSRootType_ServerGroup	1	Server group node.


Object, Property, or Method Reserved

This DTS object, property, or method is reserved for future use.


See SQL Server Books Online to review this topic.