Microsoft SQL Server Distributed Management Object Model


Microsoft SQL Server Distributed Management Object Model


Microsoft SQL Server Distributed Management Object Model


Before You Begin

The programming components in Microsoft® SQL Server™ 6.0 enable you to develop sophisticated client/server applications that tap the power of Microsoft SQL Server.

Microsoft SQL Distributed Management Objects (SQL-DMO) enable you to create administrative programs for SQL Server 6.0.


About Programming Open Data Services
About Programming SQL Distributed Management Objects

Microsoft SQL Server Programming SQL Distributed Management Objects provides syntax and reference information about the SQL Distributed Management Objects, 32-bit OLE Automation objects for the Microsoft® Windows® 95 and Microsoft® Windows NT™ operating systems. These objects, properties, methods, and collections are used to write scripts and programs that can administer multiple SQL Servers distributed across a network.

This book is written for developers and administrators who are writing scripts or programs to administer SQL Servers. It assumes that you are familiar with SQL Servers and with Microsoft® Visual C++ or the Microsoft® Visual Basic® programming system.

This book also assumes that you are familiar with DB-Library and/or ODBC, and with Transact-SQL™, the enhanced version of SQL (structured query language). For information about Transact-SQL, see the Microsoft SQL Server Transact-SQL Reference.


Document Conventions

This book uses the following conventions to distinguish elements of text:

Convention	Purpose
UPPERCASE	Represents statement and clause names, structure names,  filenames, and paths.
bold	Represents functions and syntax.
italic	Represents variables that appear in text, database names, table names, column names, and index names.
monospace	Represents examples and sample program code.


Finding Further Information

This book contains reference information to help you write SQL-DMO administrative programs for Microsoft SQL Server. Additional information about SQL Server 6.0 is available from the following sources.

Online Help

To access online Help while using SQL-DMO, choose the SQL-DMO Help icon.

SQL Server Documentation

The documentation for SQL Server 6.0 is available online as part of the Microsoft® Development Library and as Microsoft SQL Server Books Online, which is part of Microsoft SQL Server and Microsoft® SQL Server Workstation.

Microsoft SQL Server Setup

Provides instructions for installing SQL Server 6.0 servers and clients.

Microsoft SQL Server System Administrator's Companion

Incorporates configuration, administration, and troubleshooting topics. Describes server and client configuration. Explains system administration tasks, such as managing devices and databases, backing up and recovering data, performing replication, scheduling tasks, managing security, and monitoring performance. Describes error conditions and gives troubleshooting procedures.

Microsoft SQL Server Database Developer's Companion

Provides an overview of Transact-SQL, which is an enhanced version of SQL (structured query language). Discusses managing data and database objects, such as tables, views, indexes, stored procedures, defaults, rules, constraints, and user-defined datatypes.

Microsoft SQL Server Transact-SQL Reference

Explains how to use Transact-SQL statements and other features to access databases, and provides syntax and descriptions for Transact-SQL statements, system procedures, utility programs, and system tables.

Microsoft SQL Server Programming SQL Distributed Management Objects

The online version of this book, provides syntax and reference information for the SQL Distributed Management Objects, which are 32-bit OLE Automation objects for the Microsoft Windows 95 and Windows NT operating systems.

Microsoft SQL Server Programming DB-Library for C

Provides syntax and reference information for the DB-Library application programming interface (API), which is used to write C/C++ client programs for the Windows, Windows 95, Windows NT, and MS-DOS® operating systems.

Microsoft SQL Server Programming DB-Library for Visual Basic

Provides syntax and reference information for the DB-Library API, which is used to write Microsoft Visual Basic programming system−based client programs for the Windows operating system.


Obtaining Technical Support

Microsoft offers a variety of support options to help you get the most from Microsoft SQL Server. For information about these options, see the service and support card available in the Microsoft SQL Server and Microsoft SQL Workstation packages, and the online support information in the Microsoft Development Library.


Chapter 1   Getting Started
Getting Started

SQL Distributed Management Objects (SQL-DMO) are 32-bit Component Object Model (COM) objects for the Microsoft Windows 95 and Windows NT operating systems. The SQL-DMO objects are OLE Automation Compatible. The SQL-DMO object model includes objects, properties, methods, and collections that are used to write programs that can administer multiple SQL Servers distributed across a network. SQL-DMO programs can range from simple Visual Basic scripts to complex C++ applications. SQL-DMO is the foundation of SQL Enterprise Manager.


SQL-DMO Object Model

The following illustration shows the SQL-DMO object model:


SQL-DMO Files

The following SQL-DMO files are included with the SQL Server 32-bit client tools for Windows 95 and Windows NT, which you must install to use SQL-DMO.

In C:\SQL60\DLL

File	Description
SQLOLE.HLP	Help file containing reference information about SQL-DMO objects, properties, methods, lists, and collections.
SQLOLE.REG	SQL-DMO Registry file.
SQLOLE32.DLL	SQL-DMO in-process server and COM custom component.
SQLOLE32.TLB	SQL-DMO type library, usually used by OLE Automation controllers like Visual Basic.
In C:\SQL60\INSTALL

File	Description
SQLOLE42.SQL	Transact-SQL script to create SQL-DMO stored procedures for SQL Server 4.21 servers. You must install these on a SQL Server 4.21 server before SQL-DMO objects can connect to that server.
SQLOLE60.SQL	Transact-SQL script to create SQL-DMO stored procedures for SQL Server 6.0 servers. These are already installed by SQL Server 6.0.
In C:\SQL60\SQLOLE\INCLUDE

File	Description
SQLOLE.H	Header file for C++ programs containing function prototypes for SQL-DMO objects, properties, methods, lists, and collections.
SQLOLEID.H	Header file for C++ programs containing class IDs and interface IDs for SQL-DMO.
In C:\SQL60\SQLOLE\SAMPLES

File	Description
README.TXT	Summary of sample programs available in each directory.


Chapter 2   Using SQL-DMO Objects
Using SQL-DMO Objects

This chapter provides instructions for using SQL-DMO objects in your Visual Basic and C++ programs. The SQL-DMO custom component provides 32-bit COM objects which can be used from 32-bit Visual Basic programs and 32-bit C++ programs.

The SQL-DMO component name or application name is SQLOLE.

For brevity, the sample code included in this chapter does not check for success or handle errors.

Visual Basic

Visual Basic is an OLE Automation controller. You can use Visual Basic to write programs that use SQL-DMO objects. The steps required to use SQL-DMO objects in a Visual Basic program are:

1.	Include the SQL-DMO type library.

2.	Create a SQLServer object.

3.	Connect the SQLServer object.

4.	Use the SQLServer object and other contained objects.

5.	Release the SQLServer object.

Use a period (.) to separate an object variable from the properties, methods and collections of that object.

C++

You can use C++ and OLE functions to write programs that use SQL-DMO objects. The steps required to use SQL-DMO objects in a C++ program are:

1.	Include the SQL-DMO and OLE header files, and link to OLE libraries.

2.	Initialize the COM library.

3.	Create a SQLServer object.

4.	Connect the SQLServer object.

5.	Use the SQLServer object and other contained objects.

6.	Release the SQLServer object.

7.	Uninitialize the COM library.

Use the member-selection operator (->) to separate a "pointer to an object" variable from the property, method, and collection functions.


Including SQL-DMO

The first step to programming with SQL-DMO objects is to include the appropriate type library or header files in your project.

The complete SQL-DMO type library is contained in the SQLOLE32.TLB file, located in the C:\SQL60\DLL directory by default. The type library contains information about all SQL-DMO objects, properties and methods, and is usually used by OLE Automation controllers like Visual Basic.

Visual Basic

To give Visual Basic access to the SQL-DMO object definitions, you should include the SQL-DMO type library in your Visual Basic project or module. Including the type library is required if you want to declare a Visual Basic object variable as a SQL-DMO object type. Including the SQL-DMO type library is not necessary if you want to declare a Visual Basic object variable as a generic Object type.

To include the SQL-DMO type library in your project, you usually follow these steps. From the Tools menu, choose References. The References dialog appears. Choose the Browse button, and include the SQLOLE32.TLB file. This requires that the Visual Basic environment or module code editor be active and running. For example, to create a new Visual Basic module using Excel 5.0 for Windows NT, from the Insert menu, choose Macro and then Module.

C++

The SQL-DMO objects include both ANSI and Unicode custom interfaces. When using ANSI interfaces, all SQL-DMO strings are ANSI strings with one byte per character. When using the Unicode interfaces, all SQL-DMO strings are Unicode strings with two bytes per character. All SQL-DMO strings use the SQLOLE_BSTR string datatype.

The ANSI custom interfaces and ANSI SQLOLE_BSTR strings are used by default. If you want to use the Unicode custom interfaces and Unicode SQLOLE_BSTR strings, you must define UNICODE and _UNICODE before including all the header files. For example:

#define UNICODE

#define _UNICODE

Use the TEXT("str") macro around string values. By default these are ANSI "str" strings. When UNICODE and _UNICODE are defined these are Unicode L"str" strings.

In 32-bit OLE, all BSTR strings are Unicode strings.

To give your C++ program access to the SQL-DMO object definitions, you must include the SQLOLEID.H and SQLOLE.H header files, in addition to the Windows and OLE header files. The SQL-DMO header files are located in the C:\SQL60\SQLOLE\INCLUDE directory by default. The Include setting of the Visual C++ project or the INCLUDE environment variable should point to the directory that contains these files.

You must include the following header files in this order:

1.	WINDOWS.H

2.	INITGUID.H (This file must be included once and only once)

3.	SQLOLEID.H

4.	SQLOLE.H

For example:

#include <windows.h>

#include <initguid.h>

#include <sqloleid.h>

#include <sqlole.h>

SQL-DMO does not have a link library. However, to build your SQL-DMO application, you must link to the following OLE libraries:

•	OLE32.LIB

•	OLEAUT32.LIB

•	UUID.LIB

The Library setting of the Visual C++ project or the LIB environment variable should point to the directory that contains these files.


Initializing the COM Library

Before your program can use SQL-DMO objects, the COM library must be initialized.

Visual Basic

Your SQL-DMO program does not need to initialize OLE. Visual Basic automatically initializes OLE and the COM library.

C++

All SQL-DMO and OLE functions return an HRESULT value. The HRESULT contains information about the success or failure of the SQL-DMO or OLE function. You can declare a single HRESULT variable and re-use it. For example:

HRESULT hr;

Before calling any SQL-DMO or COM functions, your SQL-DMO program must initialize the COM library by using the OLE CoInitialize function. For example:

hr = CoInitialize (NULL);

You must pass NULL to CoInitialize.

To initialize OLE you can use the OleInitialize function. This automatically initializes the COM library. For more information about OLE functions, see your OLE programming documentation.


Creating a SQLServer Object

The core of SQL-DMO is the SQLServer object. For each SQL Server you want to connect to, you create an empty SQLServer object, then you connect the SQLServer object to a running SQL Server.

The methods described here are used to create all types of creatable SQL-DMO objects, including a SQLServer object. When a new SQL-DMO object is created, the object is empty, and its properties are initialized to default values.

Visual Basic

There are three methods for creating SQL-DMO objects in Visual Basic. All three methods involve using the Dim statement to declare an object variable of a certain type.

The SQL-DMO application name is SQLOLE. It is recommended that you use the application name SQLOLE when creating and declaring SQL-DMO objects. This avoids ambiguity if another OLE components includes objects with common names, such as Table or Database.

Specific SQL-DMO object type

The preferred method (if your version of Visual Basic supports it) is to use a Dim statement to declare an object variable of a specific SQL-DMO object type. This method requires that the SQL-DMO type library be included in your Visual Basic project. To actually create a new instance of a SQL-DMO object, you can use the New keyword in your Dim statement (if your version of Visual Basic supports it), or you can use CreateObject function.

For example, to create a new SQLServer object using the New keyword:

Dim oSQLServer As New SQLOLE.SQLServer

For example, to declare and create a new SQLServer object using the CreateObject function:

Dim oSQLServer As SQLOLE.SQLServer

Set oSQLServer = CreateObject ("SQLOLE.SQLServer")

Some versions of Visual Basic use virtual function table binding (vtable-binding), or early-binding. The SQL-DMO custom interfaces are used directly (not through the OLE IDispatch interface), resulting in the best performance.

Some versions of Visual Basic use a form of late-binding called dispatch ID binding (dispID-binding) using OLE IDispatch. The IDispatch::Invoke function is used with the dispIDs included in the SQL-DMO type library. This method will give your application slower performance than using the New keyword, but faster performance than using the Object type.

Generic Object type

The other method (supported by all versions of Visual Basic) is to use a Dim statement to declare a new variable of the generic Object type, then use the CreateObject function to create a new instance of a SQL-DMO object and assign it to the object variable. This method does not require the SQL-DMO type library.

For example, to declare and create a new SQLServer object using the generic Object type:

Dim oSQLServer As Object

Set oSQLServer = CreateObject ("SQLOLE.SQLServer")

This method is called late-binding using OLE IDispatch. The IDispatch::GetIDsOfNames function is used to get the dispIDs, which are passed to the IDispatch::Invoke function. This method will give your application slower performance than declaring an object variable of a specific SQL-DMO object type.

C++

There is only one method to create a SQL-DMO object in C++. Declare an object variable of the appropriate SQL-DMO "pointer to an object" type. For an object named Object, the SQL-DMO object type is LPSQLOLEOBJECT. Then use the OLE CoCreateInstance function to create a new instance of a SQL-DMO object. You pass the following parameters to CoCreateInstance:

1.	Class ID of a SQL-DMO object

2.	NULL

3.	CLSCTX_INPROC_SERVER

4.	Interface ID of a SQL-DMO object

5.	Address of the SQL-DMO "pointer to an object" variable (use the address of & operator)

For example, to create a new SQLServer object:

LPSQLOLESERVER pSQLServer = NULL;

hr = CoCreateInstance (CLSID_SQLOLEServer,

    NULL,

    CLSCTX_INPROC_SERVER,

    IID_ISQLOLEServer,

    (LPVOID*)&pSQLServer);

Note  A multithreaded program must serialize all access to SQL-DMO to avoid reentrancy.


Connecting the SQLServer Object

After creating a new, empty SQLServer object, you connect that object to a running SQL Server using the Connect method of the new SQLServer object. You pass the following parameters to the Connect method:

1.	SQL Server name

2.	Login ID

3.	Password

When the Connect method is successful, the SQLServer object is filled with information about the connected SQL Server. The SQLServer object and all objects "under" the SQLServer object (in the SQL-DMO object hierarchy) are now valid and available for use. This includes the following:

•	All SQLServer properties (including object properties) are set to the appropriate values.

•	All supported SQLServer methods are available.

•	All SQLServer collections are available and filled with objects as you request them.

•	All objects "under" SQLServer are available for use.

SQL-DMO also adds the connected SQLServer object to the Application.SQLServers collection.

SQL-DMO retrieves information from SQL Server as you request it by using the SQLServer objects. SQL-DMO maintains this SQL Server information in a cache stored in client memory. SQL-DMO improves performance by using this cached information to minimize SQL Server queries. The cache is contained in the collection objects, and you can use the Refresh method to update the cache with current values from SQL Server.

Visual Basic

You can call the Connect method using Visual Basic procedure syntax. For example:

oSQLServer.Connect "myserver", "mylogin", "mypassword"

You can also call the Connect method using Visual Basic function syntax. For example:

Call oSQLServer.Connect ("myserver", "mylogin", "mypassword")

C++

Call the Connect method. For example:

hr = pSQLServer->Connect (TEXT("myserver"),

    TEXT("mylogin"),

    TEXT("mypassword"));


Declaring and Assigning Object Variables

To store a SQL-DMO object returned from another object, you must declare an object variable of the appropriate SQL-DMO object type.

Visual Basic

Declare an object variable of a specific SQL-DMO object type (if your version of Visual Basic supports it). This uses early, vtable-binding or dispID-binding, depending on your version of Visual Basic, and requires that the SQL-DMO type library be included in your Visual Basic project. For example:

Dim oDatabase As SQLOLE.Database

Or you can declare an object variable of the generic Object type. This uses late-binding, and does not require the SQL-DMO type library. For example:

Dim oDatabase As Object

Then assign a returned SQL-DMO object (from a collection, an object property, or a method return value) to the declared object variable. For example:

Set oDatabase = oSQLServer.Databases("pubs")

Note that you can assign a returned SQL-DMO object to an object variable declared using the New keyword (if your version of Visual Basic supports it). Visual Basic will automatically release an object created by the New keyword before assigning a new object to the variable. However, if you are declaring an object variable just to hold a returned SQL-DMO object, do not use the New keyword. The overhead of creating and releasing the object is unnecessary.

C++

Declare an object variable of the appropriate SQL-DMO "pointer to an object" type. All SQL-DMO object types begin with LPSQLOLE.

For example, to declare a new Database object variable and assign the pubs database object (part of the SQLServer.Databases collection) to the new object variable:

LPSQLOLEDATABASE pDatabase = NULL;

hr = pSQLServer->GetDatabaseByName (TEXT("pubs"),

    (LPVOID*)&pDatabase);


Using Property Values

A property is a data item stored in a SQL-DMO object. You can get almost all property values, but you can set (change) only certain property values.


Getting a Property

Because all SQL-DMO property values are read-only or read-write, you can get all property values.

Visual Basic

To get a property, use the following syntax:

[Set] variable = Object.Property

For example, to get a long property:

Dim lTime As Long

lTime = oSQLServer.LoginTimeout

For example, to get a string property:

Dim strHost As String

strHost = oSQLServer.HostName

For example, to get an object property:

Dim oConfiguration As SQLOLE.Configuration

Set oConfiguration = oSQLServer.Configuration

You can also use the Object.Property value directly as part of a more complex expression.

C++

For a property named Property, you use a function named GetProperty to get a property value. Because all SQL-DMO functions return an HRESULT, you must pass the address of a program variable (use the address of & operator) of the appropriate type to the GetProperty function. The GetProperty function will write the current property value to your program variable. Use the following syntax:

pObject->GetProperty ( &variable );

For example, to get a long property:

LONG lTime;

pSQLServer->GetLoginTimeout (&lTime);

Getting a string property requires an extra step. A GetProperty function for a string property takes a parameter of type SQLOLE_LPBSTR, which is the address of a SQLOLE_BSTR variable. You pass the address of a SQLOLE_BSTR variable to the GetProperty function. The GetProperty function will allocate a new string and then write the current property value to the newly allocated string. After your program is finished using the string (allocated by SQL-DMO) it must call SQLOLEFreeString macro to deallocate the string.

For example, to get a string property:

SQLOLE_BSTR strHost;

pSQLServer->GetVersionString (&strHost);

// use strHost

SQLOLEFreeString (strHost);

SQLOLEFreeString is mapped to the OLE SysFreeString function, with an appropriate conversion for ANSI strings when you are using the SQL-DMO ANSI interfaces.

For example, to get an object property:

LPSQLOLECONFIGURATION pConfiguration = NULL;

hr = pSQLServer->GetConfiguration (&pConfiguration);


Setting a Property

You can set (change) only read-write SQL-DMO properties.

Visual Basic

To set a property, use the following syntax:

Object.Property = value

For example, to set a long property:

oSQLServer.LoginTimeout = 30

To set a string property:

oSQLServer.HostName = "Gizmo"

Note that you cannot set object properties; they are read-only.

C++

For a property named Property, you use a function named SetProperty to set a property to a new value. Pass a program variable of the appropriate type to the SetProperty function. The SetProperty function will read the new value from the program variable and set the object property to that value. Use the following syntax:

pObject->SetProperty ( variable );

For example, to set a long property:

pSQLServer->SetLoginTimeout (30);

To set a string property:

pSQLServer->SetVersionString (TEXT("Gizmo"));

Note that you cannot set object properties; they are read-only.


Using the Properties Collection

The Property object and the Properties collection are only available in Visual Basic.

Visual Basic

Each SQL-DMO object (not including collections) has a Properties collection that contains one Property object for each property (not including object properties or indexed properties) of the SQL-DMO object.

Using the Properties collection and the following properties of the Property object you can:

•	Enumerate the property names of a SQL-DMO object at run time using the Name property.

•	Get and set the value of a property name determined at run time using the Value property.

For example:

For Each oProperty in oSQLServer.Properties

    Debug.Print oProperty.Name & " = " oProperty.Value

Next

The default property of a Property object is the Value property.

C++

The Property object and the Properties collection are not available in C++.


Calling Methods

A method is a function that performs an action using a SQL-DMO object.

Visual Basic

To call a method that takes no parameters, use the following syntax:

[return =] Object.Method

To call a method that takes parameters and doesn't return a value (or to ignore any return value), use the following syntax:

Object.Method [Name1 :=] param1, [Name2 :=] param2, ...

To call a method that takes parameters and returns a value, use the following syntax:

return = Object.Method ( [Name1 :=] param1, [Name2 :=] param2, ... )

The Name items are optional parameter names. If you include parameter names, you can specify the method parameters in any order. If you do not use parameter names, you must specify the method parameters in the required order.

For example:

Dim oQueryResults As SQLOLE.QueryResults

oQueryResults = oSQLServer.ReadErrorLog (0)

C++

To call a method that takes no parameters, use the following syntax:

pObject->Method ( );

To call a method that takes parameters (but no return parameters), use the following syntax:

pObject->Method ( param1, param2, ... );

If the method has a return parameter, you must pass the address of a program variable (use the address of & operator) of the appropriate type as the return parameter. The method will write the return value to your program variable.

To call a method that takes a single return parameter, use the following syntax:

pObject->Method ( &return );

To call a method that takes input parameters (but no optional parameters) and a required or optional return parameter, or a method that takes required and optional input parameters and an optional return parameter, use the following syntax:

pObject->Method ( param1, param2, ..., &return );

To call a method that takes required input parameters, a required return parameter, and optional input parameters, use the following syntax:

pObject->Method ( req_param1, ..., &return, opt_param2, ... );

For example:

LPSQLOLEQUERYRESULTS pQueryResults = NULL;

pSQLServer->ReadErrorLog (&pQueryResults, 0);


Using Collections

A collection contains a group of objects, all of the same type. The name of a collection is the plural name of the object type it contains. For example, the Databases collection contains a group of Database objects.

A collection is contained within a parent object. For example, the SQLServer object contains the Databases collection.


Getting a Collection Object

A collection is really a collection object that contains all the specific objects in the collection. Like all objects, a collection object has properties and methods.

Visual Basic

For a collection named Objects, use the following syntax to refer to a collection object:

Parent.Objects

For example, to refer to the Databases collection of a SQLServer object:

oSQLServer.Databases

C++

For a collection named Objects, you use a function named GetObjects to get a collection object from the parent object. Pass the address of a collection object variable (use the address of & operator) of the appropriate type (LPSQLOLEOBJECTS) to the GetObjects function. The GetObjects function will write the collection object pointer to your object variable. Use the following syntax:

pParent->GetObjects ( &pObjects );

For example, to get the Databases collection object from a SQLServer object:

LPSQLOLEDATABASES pDatabases;

pSQLServer->GetDatabases (&pDatabases);


Getting a Specific Object from a Collection

You must get a specific object from a collection before you can use it.

Visual Basic

Because the Item method is the default method of a collection object, you can get a specific object in a collection by specifying one of the following:

•	Object name

•	Ordinal value (1-based) within the collection

in parentheses after the collection object. You can also use the Item method explicitly. These use the following syntax:

Parent.Objects( {strName | lOrdinal} )

Or

Parent.Objects.Item( {strName | lOrdinal} )

For example, to refer to the pubs database of the SQLServer.Databases collection:

oSQLServer.Databases("pubs")

To refer to the first database of the SQLServer.Databases collection:

oSQLServer.Databases(1)

A parent object has a default collection. You can use the ! default collection specifier instead of the default collection name and item name specifier. Use the following syntax:

Parent!name

The following table lists the default collections for parent SQL-DMO objects.

Parent Object	Default Collection
Configuration	ConfigValues
Executive	Tasks
SQLServer	Databases
Database	Tables
Table	Columns
For example, to refer to the pubs database of the default Databases collection of the SQLServer object:

oSQLServer!pubs

Some SQL-DMO collections support the ItemByID method. This allows you to get a specific object using that object's unique SQL Server identifier. Use the following syntax:

Parent.Objects.ItemByID( lID )

For example, to refer to the database of the SQLServer.Databases collection that has a SQL Server database ID of 1:

oSQLServer.Databases.ItemByID(1)

C++

When you have a pointer to a collection object, you can get a pointer to a specific object in that collection by using the GetItemByOrd or GetItemByName function, or (for collections that support it) by using the GetItemByID function.

To use GetItemByOrd, pass an ordinal value (0-based) and the address of an object variable (use the address of & operator) of the appropriate type (LPSQLOLEOBJECT) to the function. It will write the specific object pointer to your object variable. Use the following syntax:

pObjects->GetItemByOrd ( lOrdinal, &pObject );

To use GetItemByName, pass the name of the specific object and the address of an object variable of the appropriate type (LPSQLOLEOBJECT) to the function. It will write the specific object pointer to your object variable. Use the following syntax:

pObjects->GetItemByName ( strName, &pObject );

Some SQL-DMO objects support the GetItemByID function. This allows you to get a specific object using that object's unique SQL Server identifier. To use GetItemByID, pass the unique object ID and the address of an object variable of the appropriate type (LPSQLOLEOBJECT) to the function. It will write the specific object pointer to your object variable. Use the following syntax:

pObjects->GetItemByID ( lID, &pObject );

For example, to get the pubs database from the SQLServer.Databases collection:

LPSQLOLEDATABASES pDatabases;

pSQLServer->GetDatabases (&pDatabases);

LPSQLOLEDATABASE pDatabase;

pDatabases->GetItemByName (TEXT("pubs"), &pDatabase);

The SQL-DMO custom interfaces also include "shortcut" functions that allow you to get a specific object in a collection directly from the parent object. These single functions can be used instead of getting the collection object first, then getting the specific object. Use the following syntax:

pParent->GetObjectByName ( strName, &pObject );

pParent->GetObjectByOrd ( lOrdinal, &pObject );

pParent->GetObjectCount ( &lCount );

For example, to get the pubs database from the SQLServer.Databases collection:

LPSQLOLEDATABASE pDatabase;

pSQLServer->GetDatabaseByName (TEXT("pubs"), &pDatabase);


Iterating Through a Collection

It is often useful to perform a series of operations on every specific object in a collection.

Visual Basic

Use the Visual Basic For Each statement to iterate through all specific objects in a collection. For example:

For Each oDatabase in oSQLServer.Databases

    Debug.Print oDatabase.Name

Next

C++

You can use the GetCount and GetItemByOrd functions of a collection object to iterate through all specific objects in a collection. Use the following syntax for GetCount:

pObjects->GetCount ( &lCount );

For example:

LPSQLOLEDATABASES pDatabases;

LPSQLOLEDATABASE pDatabase;

long i, lCount;

pSQLServer->GetDatabases (&pDatabases);

pDatabases->GetCount (&lCount);

for (i = 0; i < lCount; i++)

{

    pDatabases->GetItemByOrd (i, &pDatabase);

    // use the specific pDatabase object

}

You can also use the GetObjectCount and GetObjectByOrd "shortcut" functions of the parent object to iterate through all specific objects in a collection. For example:

LPSQLOLEDATABASE pDatabase;

long i, lCount;

pSQLServer->GetDatabaseCount (&lCount);

for (i = 0; i < lCount; i++)

{

    pSQLServer->GetDatabaseByOrd (i, &pDatabase);

    // use the specific pDatabase object

}


Adding a New Object to a Collection

To add a new SQL-DMO object to a collection, you use the following steps:

1.	Create a new instance of a SQL-DMO object.

2.	Set the properties of the new SQL-DMO object.

3.	Add the new SQL-DMO object to the appropriate collection.

Adding a SQL-DMO object to a collection creates that SQL Server object.

Visual Basic

After creating a new SQL-DMO object with the New keyword of the Dim statement or the CreateObject function, you set the properties of the new object as appropriate for the new object. Then you add the new object to the appropriate collection using the following syntax:

Objects.Add NewObject

C++

After creating a new SQL-DMO object with the CoCreateInstance function, you set the properties of the new object as appropriate for the new object. Then you add the new object to the appropriate collection using the following syntax:

pObjects->Add ( pNewObject );

You can also use the AddObject "shortcut" function of the parent object to add the new object using the following syntax:

pParent->AddObject ( pNewObject );


Removing an Existing Object from a Collection

Removing an existing SQL-DMO object from a collection drops that SQL Server object.

Visual Basic

You remove an existing object from a collection by specifying one of the following:

•	Object name

•	Ordinal value within the collection (the first ordinal value is number 1)

using the following syntax:

Objects.Remove ( {strName | lOrdinal} )

You can also remove an existing object directly using the following syntax:

Object.Remove

C++

You remove an object from a collection by name or by ordinal value (the first ordinal value is number 0) using the following syntax:

pObjects->RemoveByName ( strName );

pObjects->RemoveByOrd ( lOrdinal );

You can also use the RemoveObjectByName or RemoveObjectByOrd "shortcut" functions of the parent object to remove an existing object by name or by ordinal value (0-based) using the following syntax:

pParent->RemoveObjectByName ( strName );

pParent->RemoveObjectByOrd ( lOrdinal );


Refreshing a Collection

When you use the Refresh collection method, SQL-DMO refreshes objects with current information from SQL Server. The Refresh method takes a single Boolean parameter, indicating if you want to release all objects in the collection and "under" the collection in the SQL-DMO hierarchy.

•	If True, SQL-DMO releases all objects in the collection and all objects "under" the collection. SQL-DMO then refreshes the collection with current information from SQL Server. All objects "under" the refreshed collection are reinitialized, and current information will be retrieved from SQL Server as you use them. This invalidates all object variables you have that refer to any object in the refreshed collection, or to any object "under" the refreshed collection.

•	If False, SQL-DMO releases only those objects in the collection that have been dropped from SQL Server. SQL-DMO then refreshes the entire collection with current information from SQL Server. It will not release or refresh any objects "under" the collection. This invalidates any object variables you have that refer to objects that are no longer in the refreshed collection because they have been dropped from SQL Server.

Some objects that cache a lot of SQL Server information have a direct Refresh method.

Visual Basic

To use the Refresh collection method, use the following syntax:

Parent.Objects.Refresh ( bRelease )

Do not call Refresh within a For Each loop.

C++

To use the Refresh collection method, use the following syntax:

pObjects->Refresh ( bRelease );


Using Lists

Lists are methods that begin with List and return a list of SQL-DMO objects. You use a list in the same way as a collection, except that you cannot add or remove objects from a list.

An objects in a list is usually a "cross-reference" to an object which is contained in a collection. The List object uses an index of identifiers to get appropriate objects from the collection.


Getting a List Object

A list object includes a group of specific objects. Like all objects, a list object has properties and methods.

Visual Basic

For a list method named ListObjects, use the following syntax to refer to a list object:

Parent.ListObjects

For example, to refer to the ListStartupProcedures list (of StoredProcedure objects) of a SQLServer object:

oSQLServer.ListStartupProcedures

The StoredProcedure objects in this list are contained in the Database.StoredProcedures collection.

C++

Use the ListObjects list method to get a list object from the parent object. Pass the address of a list object variable (use the address of & operator) of the appropriate type (LPSQLOLEOBJECTLIST) to the ListObjects function. The ListObjects function will write the list object pointer to your object variable. Use the following syntax:

pParent->ListObjects ( &pObjectList );

For example, to use the ListStartupProcedures list method to get a StoredProcedure list from a SQLServer object:

LPSQLOLESTOREDPROCEDURELIST pStoredProcedureList;

pSQLServer->ListStartupProcedures (&pStoredProcedureList);

The StoredProcedure objects in this list are contained in the Database.StoredProcedures collection.


Getting a Specific Object from a List

You must get a specific object from a list before you can use it.

Visual Basic

Because the Item method is the default method of a list, you can get a specific object in a list by specifying one of the following:

•	Object name

•	Ordinal value (1-based) within the list

in parentheses after the list object. You can also use the Item method explicitly. Use the following syntax:

Parent.ListObjects( {strName | lOrdinal} )

Or

Parent.ListObjects.Item( {strName | lOrdinal} )

C++

When you have a pointer to a list object, you can get a pointer to a specific object in that list by using the GetItemByOrd or GetItemByName function.

To use GetItemByOrd, pass an ordinal value (0-based) and the address of a list object variable (use the address of & operator) of the appropriate type (LPSQLOLEOBJECTLIST) to the function. It will write the specific object pointer to your object variable. Use the following syntax:

pObjectList->GetItemByOrd ( lOrdinal, &pObject );

To use GetItemByName, pass the name of the specific object and the address of a list variable of the appropriate type (LPSQLOLEOBJECTLIST) to the function. It will write the specific object pointer to your object variable. Use the following syntax:

pObjectList->GetItemByName ( strName, &pObject );


Iterating Through a List

It is often useful to perform a series of operations on every object in a list.

Visual Basic

Use the Visual Basic For Each statement to iterate through all specific objects in a list. For example:

For Each oStoredProcedure in oSQLServer.ListStartupProcedures

    Debug.Print oStoredProcedure.Name

Next

C++

You can use the GetCount and GetItemByOrd functions of a list object to iterate through all specific objects in a list. Use the following syntax for GetCount:

pObjectList->GetCount ( &lCount );

For example:

LPSQLOLESTOREDPROCEDURELIST pStoredProcedureList;

LPSQLOLESTOREDPROCEDURE pStoredProcedure;

long i, lCount;

pSQLServer->ListStartupProcedures (&pStoredProcedureList);

pStoredProcedureList->GetCount (&lCount);

for (i = 0; i < lCount; i++)

{

    pStoredProcedureList->GetItemByOrd (i, &pStoredProcedure);

    // use the specific pDatabase object

}


Refreshing a List

When you use the Refresh list method, SQL-DMO updates the index of identifiers for that list. This does not release or invalidate any object variables you have that refer to an object in the refreshed list.

Visual Basic

To use the Refresh list method, use the following syntax:

Parent.ListObjects.Refresh

Do not call Refresh within a For Each loop.

C++

To use the Refresh list method, use the following syntax:

pListObjects->Refresh ( );


Releasing the SQLServer Object

When your program is finished with a SQL-DMO object it created, you must release the object. After releasing your last reference to a SQL-DMO object, the object variable is invalid and must not be used. To use the object again you must get a new reference to it.

Visual Basic

To release objects you created using the New keyword of a Dim statement or the CreateObject function, set the object variable to Nothing. For example:

Set oSQLServer = Nothing

Visual Basic will automatically release an object when the object variable goes out of scope.

C++

Use the Release function to release objects you created using the OLE CoCreateInstance function. For example:

pSQLServer->Release();


Uninitializing the COM Library

Before your program exits, the COM library must be uninitialized.

Visual Basic

Your SQL-DMO program does not need to uninitialize OLE. Visual Basic automatically uninitializes OLE and COM when your program exits.

C++

After completing all use of SQL-DMO or COM functions, your program must uninitialize the COM library by calling the OLE CoUninitialize function. For example:

CoUninitialize ();

To uninitialize OLE you can use the OleUninitialize function. This automatically uninitializes the COM library.


Error Handling

When a SQL-DMO operation fails, it returns an error number and description. This error can be one of the following:

•	A SQL Server error from the sysmessages table.

•	A DB-Library error. Error numbers range from SQLOLE_E_DBLIBFIRSTERROR through SQLOLE_E_DBLIBLASTERROR.

•	A SQL-DMO error. Error numbers range from SQLOLE_E_FIRSTERROR through SQLOLE_E_LASTERROR.

Each SQL-DMO error number has a SQLOLE_E_ERROR error constant. Use these SQL-DMO error constants (instead of hard-coded error numbers) in your program.

SQL-DMO errors are grouped into categories. Each category has a SQLOLE_ECAT_CATEGORY category constant. To get the category constant, binary And the SQL-DMO error number with SQLOLE_ECAT_MASK.

•	The binary And operator in Visual Basic is And.

•	The binary And operator in C++ is &.

The following table describes each error category:

SQL-DMO Error Category	Description
SQLOLE_ECAT_INVALIDCONTEXT	The requested operation is not valid in the current context.
SQLOLE_ECAT_INVALIDOBJECT	The SQL-DMO object is no longer valid.
SQLOLE_ECAT_ INVALIDOBJECTDEFINITION	The attempt to add a new SQL-DMO object to a collection failed because the properties of the new object were set incorrectly or incompletely.
SQLOLE_ECAT_INVALIDPARAMETER	An invalid parameter was passed to a method or property.
SQLOLE_ECAT_INVALIDPLATFORM	The client or SQL Server platform does not support the requested operation. The version of SQL Server is not supported, the SQL-DMO stored procedures are not properly installed, or the client platform is not supported.
SQLOLE_ECAT_ITEMNOTFOUND	The object name passed to a collection was not found, or the ordinal value passed to a collection was out of range.
SQLOLE_ECAT_UNPRIVILEGEDLOGIN	The current login ID does not have sufficient privilege to perform the requested operation.
SQLOLE_ECAT_EXECUTION	An error occurred when executing a Transact-SQL query.
SQLOLE_ECAT_CONNECTION	The connection to SQL Server was broken and cannot be restored.
SQLOLE_ECAT_RESOURCE	The client or SQL Server does not have sufficient resources to perform the requested operation.
Visual Basic

By default, any SQL-DMO run-time error that occurs is fatal. This will stop execution of your Visual Basic program and display an error message. To handle SQL-DMO run-time errors in your program, you must use an On Error statement.

•	Use an On Error Resume Next statement to continue program execution at the statement immediately following the statement where the error occurred.

•	Use an On Error GoTo HandlerLabel to branch program execution to the HandlerLabel label, making the error handler active.

Vtable-binding

If your version of Visual Basic supports early, vtable-binding, then it supports the Visual Basic Err object, which is used to return SQL-DMO run-time error information to the program. The Err object includes properties that can be used as shown in the following table:

Use	To Get
Err.Number − vbObjectError	SQL-DMO error number
Err.Description	SQL-DMO error description
Err.Source	SQL-DMO component name
Note that you must subtract the Visual Basic constant vbObjectError from the Err.Number property to get the SQL-DMO error number.

For example:

On Error Resume Next

oSQLServer.Connect "myserver", "mylogin", "mypassword"

If Err.Number <> 0 Then

    Debug.Print Err.Source & " Error " & _

        Err.Number - vbObjectError & ": " & _

        Err.Description

End If

DispID-binding, late-binding

If your version of Visual Basic supports dispID-binding or late-binding, then it supports the Err and Error functions, which are used to return SQL-DMO run-time error information to the program. The Err function returns the SQL-DMO error number, and the Error function returns the description of the SQL-DMO error.

For example:

On Error Resume Next

oSQLServer.Connect "myserver", "mylogin", "mypassword"

If Err <> 0 Then

    Debug.Print "SQL-DMO Error " & Err & ": " & Error(Err)

End If

C++

You should use the OLE macros SUCCEEDED(hr) and FAILED(hr) with the HRESULT hr returned by a SQL-DMO function to determine if that SQL-DMO function was successful.

•	SUCCEEDED(hr) will return TRUE if the HRESULT indicates that the SQL-DMO function succeeded.

•	FAILED(hr) will return TRUE if the HRESULT indicates that the SQL-DMO function failed.

For example, to use the FAILED macro:

if FAILED (hr = pSQLServer->Connect (TEXT("myserver"),

    TEXT("mylogin"), TEXT("mypassword")))

{

    // Connection to SQL Server failed

}

else

{

    // Established connection to SQL Server

    // Use pSQLServer object

}

To use the SUCCEEDED macro:

if SUCCEEDED (hr = pSQLServer->Connect (TEXT("myserver"),

    TEXT("mylogin"), TEXT("mypassword")))

{

    // Established connection to SQL Server

    // Use pSQLServer object

}

else

{

    // Connection to SQL Server failed

}

Use the OLE macros HRESULT_CODE(hr) or SCODE_CODE(hr) to get the SQL-DMO error number from the HRESULT hr returned by a SQL-DMO function.

Use the SQL-DMO macro SQLOLE_ECAT(hr) to get the SQL-DMO error category from the HRESULT hr returned by a SQL-DMO function that failed.

SQL-DMO supports the OLE IErrorInfo interface for passing rich error information back to the program. Use the following steps to get rich SQL-DMO error information:

1.	Call the OLE GetErrorInfo function to get an OLE ErrorInfo object (a pointer to the IErrorInfo interface).

2.	Use the ErrorInfo functions, including GetDescription and GetSource, to get rich SQL-DMO error information.

3.	Release the ErrorInfo object.

For example:

if FAILED(hr = pSQLServer->Connect (TEXT("myserver"),

    TEXT("mylogin"), TEXT("mypassword")))

{

    // Connection to SQL Server failed

    // Get OLE ErrorInfo object

    LPERRORINFO pErrorInfo = NULL;

    GetErrorInfo (0, &pErrorInfo);

    // Get SQL-DMO error information

    BSTR strDescription, strSource;

    pErrorInfo->GetDescription (&strDescription);

    pErrorInfo->GetSource (&strSource);

    // Display SQL-DMO error information

    // The SQL-DMO error code is HRESULT_CODE(hr)

    pErrorInfo->Release ();

    SysFreeString (strDescription);

    SysFreeString (strSource);

}


Datatypes

The following table describes the SQL-DMO abstract datatypes and includes the Hungarian notation prefixes used in the SQL-DMO documentation:

SQL-DMO Datatype	Prefix	Description
String	str	A generic string. For example, "Felis catus".
MultiString	mstr	A list of one or more strings delimited by semicolons. For example, "Korat; Maine Coon; Russian Blue".
Identifier	id	A string that must conform to the rules for Transact-SQL identifiers. For example "pubs".
MultiIdentifier	mid	A list of one or more identifiers delimited by semicolons. For example, "authors; titles; pub_info".
Long	l	A 4-byte integer.
Integer	i	A 2-byte integer.
Boolean	b	A True/False value. It can be True or False in Visual Basic. It can be TRUE or FALSE in C++.
Float	f	A 4-byte floating point number. For example, 4.24.
Double	d	An 8-byte floating point number. For example, 9.39.
Date	dat	In Visual Basic, an 8-byte Date value. In C++, a 4-byte integer that has the form YYYYMMDD, where YYYY is the year, MM is the number of the month, and DD is the number of the day. For example, March 22, 1995 is 19950322.
SQL-DMO also uses enumerated datatypes. Each enumeration has a datatype of SQLOLE_INFORMATION_TYPE, and contains a series of SQLOLEInfo_Value constants. The Hungarian notation prefix t is used for enumerated datatypes.

Visual Basic

The following table shows the Visual Basic datatype for each SQL-DMO abstract datatype:

SQL-DMO Datatype	Visual Basic Datatype
String	String
MultiString	String
Identifier	String
MultiIdentifier	String
Long	Long
Integer	Integer
Boolean	Boolean
Float	Single
Double	Double
Date	Date
C++

Because all SQL-DMO functions return an HRESULT, you must pass the address of a program variable (using the address of & operator) for any return parameter (such as a GetProperty function) so SQL-DMO can write to your program variable. This is the pointer datatype. For an input parameter (such as a SetProperty function), SQL-DMO only reads the program variable. This is the constant datatype.

The following table shows the C++ pointer datatype and constant datatype for each SQL-DMO abstract datatype:

SQL-DMO Datatype	C++ Pointer Datatype	C++ Constant Datatype
String	SQLOLE_LPBSTR	SQLOLE_LPCSTR
MultiString	SQLOLE_LPBSTR	SQLOLE_LPCSTR
Identifier	SQLOLE_LPBSTR	SQLOLE_LPCSTR
MultiIdentifier	SQLOLE_LPBSTR	SQLOLE_LPCSTR
Long	LPLONG	long
Integer	LPINT	int
Boolean	LPBOOL	BOOL
Float	LPFLOAT	float
Double	LPDOUBLE	double
Date	LPLONG	long


Visual Basic Objects

The following lists are the SQL-DMO objects available from Visual Basic. Objects in bold can be created using the New keyword in a Dim statement, or using the CreateObject function. Objects not in bold cannot be created, and can only be returned from other SQL-DMO objects.


SQLServer Scope

Configuration

ConfigValue

Device

Language

Login

RemoteLogin

RemoteServer

SQLServer

SubscriberInfo


Database Scope

Article

Database

DBObject

DBOption

Default

Group

Publication

Rule

StoredProcedure

Subscription

SystemDatatype

TransactionLog

User

UserDefinedDatatype


Table Scope

Check

Column

DRIDefault

Index

Key

Table

Trigger

View


Service Scope

Alert

AlertSystem

Executive

IntegratedSecurity

Operator

Registry

Task


Application Scope

Application

Backup

HistoryFilter

Names

Permission

Property

QueryResults


C++ Objects

The following lists are the SQL-DMO objects available for C++ programs. Each SQL-DMO object has a "pointer to an object" type (used for C++ variable declarations) and an interface ID, and some objects have a class ID. SQL-DMO objects that have a class ID can be created using CoCreateInstance. Objects that do not have a class ID cannot be created, and can only be returned from other SQL-DMO objects.

These values are listed in the following format:

Object

Pointer to object type

Pointer to collection object type ( −  if none)

Pointer to list object type ( −  if none)

Class ID ( −  if none)

Interface ID

The Object is bold if it can be created using CoCreateInstance.

For most SQL-DMO objects, where Object is the name of the SQL-DMO object, the Object name is used as a suffix to the variable type, class ID and interface ID as shown in the following format:

Object

LPSQLOLEOBJECT

LPSQLOLEOBJECTS

LPSQLOLEOBJECTLIST

CLSID_SQLOLEObject

IID_ISQLOLEObject

The SQLServer object is an exception. It only uses the Server suffix for the variable type, class ID, and interface ID, but still uses the complete name SQLServer for the object name.

Note that the Property object and Properties collection are not available to C++ programs.


SQLServer Scope

Configuration

LPSQLOLECONFIGURATION

−

−

−

IID_ISQLOLEConfiguration

ConfigValue

LPSQLOLECONFIGVALUE

LPSQLOLECONFIGVALUES

LPSQLOLECONFIGVALUELIST

−

IID_ISQLOLEConfigValue

Device

LPSQLOLEDEVICE

LPSQLOLEDEVICES

LPSQLOLEDEVICELIST

CLSID_SQLOLEDevice

IID_ISQLOLEDevice

Language

LPSQLOLELANGUAGE

LPSQLOLELANGUAGES

−

CLSID_SQLOLELanguage

IID_ISQLOLELanguage

Login

LPSQLOLELOGIN

LPSQLOLELOGINS

LPSQLOLELOGINLIST

CLSID_SQLOLELogin

IID_ISQLOLELogin

RemoteLogin

LPSQLOLEREMOTELOGIN

LPSQLOLEREMOTELOGINS

−

CLSID_SQLOLERemoteLogin

IID_ISQLOLERemoteLogin

RemoteServer

LPSQLOLEREMOTESERVER

LPSQLOLEREMOTESERVERS

−

CLSID_SQLOLERemoteServer

IID_ISQLOLERemoteServer

SQLServer

LPSQLOLESERVER

LPSQLOLESERVERS

−

CLSID_SQLOLEServer

IID_ISQLOLEServer

SubscriberInfo

LPSQLOLESUBSCRIBERINFO

−

−

−

IID_ISQLOLESubscriberInfo


Database Scope

Article

LPSQLOLEARTICLE

LPSQLOLEARTICLES

LPSQLOLEARTICLELIST

CLSID_SQLOLEArticle

IID_ISQLOLEArticle

Database

LPSQLOLEDATABASE

LPSQLOLEDATABASES

LPSQLOLEDATABASELIST

CLSID_SQLOLEDatabase

IID_ISQLOLEDatabase

DBObject

LPSQLOLEDBOBJECT

LPSQLOLEDBOBJECTS

LPSQLOLEDBOBJECTLIST

−

IID_ISQLOLEDBObject

DBOption

LPSQLOLEDBOPTION

−

−

−

IID_ISQLOLEDBOption

Default

LPSQLOLEDEFAULT

LPSQLOLEDEFAULTS

−

CLSID_SQLOLEDefault

IID_ISQLOLEDefault

Group

LPSQLOLEGROUP

LPSQLOLEGROUPS

−

CLSID_SQLOLEGroup

IID_ISQLOLEGroup

Publication

LPSQLOLEPUBLICATION

LPSQLOLEPUBLICATIONS

−

CLSID_SQLOLEPublication

IID_ISQLOLEPublication

Rule

LPSQLOLERULE

LPSQLOLERULES

−

CLSID_SQLOLERule

IID_ISQLOLERule

StoredProcedure

LPSQLOLESTOREDPROCEDURE

LPSQLOLESTOREDPROCEDURES

LPSQLOLESTOREDPROCEDURELIST

CLSID_SQLOLEStoredProcedure

IID_ISQLOLEStoredProcedure

Subscription

LPSQLOLESUBSCRIPTION

LPSQLOLESUBSCRIPTIONS

−

CLSID_SQLOLESubscription

IID_ISQLOLESubscription

SystemDatatype

LPSQLOLESYSTEMDATATYPE

LPSQLOLESYSTEMDATATYPES

−

−

IID_ISQLOLESystemDatatype

TransactionLog

LPSQLOLETRANSACTIONLOG

−

−

−

IID_ISQLOLETransactionLog

User

LPSQLOLEUSER

LPSQLOLEUSERS

LPSQLOLEUSERLIST

CLSID_SQLOLEUser

IID_ISQLOLEUser

UserDefinedDatatype

LPSQLOLEUSERDEFINEDDATATYPE

LPSQLOLEUSERDEFINEDDATATYPES

LPSQLOLEUSERDEFINEDDATATYPELIST

CLSID_SQLOLEUserDefinedDatatype

IID_ISQLOLEUserDefinedDatatype


Table Scope

Check

LPSQLOLECHECK

LPSQLOLECHECKS

−

CLSID_SQLOLECheck

IID_ISQLOLECheck

Column

LPSQLOLECOLUMN

LPSQLOLECOLUMNS

LPSQLOLECOLUMNLIST

CLSID_SQLOLEColumn

IID_ISQLOLEColumn

DRIDefault

LPSQLOLEDRIDEFAULT

−

−

−

IID_ISQLOLEDRIDefault

Index

LPSQLOLEINDEX

LPSQLOLEINDEXES

−

CLSID_SQLOLEIndex

IID_ISQLOLEIndex

Key

LPSQLOLEKEY

LPSQLOLEKEYS

LPSQLOLEKEYLIST

CLSID_SQLOLEKey

IID_ISQLOLEKey

Table

LPSQLOLETABLE

LPSQLOLETABLES

−

CLSID_SQLOLETable

IID_ISQLOLETable

Trigger

LPSQLOLETRIGGER

LPSQLOLETRIGGERS

−

CLSID_SQLOLETrigger

IID_ISQLOLETrigger

View

LPSQLOLEVIEW

LPSQLOLEVIEWS

−

CLSID_SQLOLEView

IID_ISQLOLEView


Service Scope

Alert

LPSQLOLEALERT

LPSQLOLEALERTS

−

CLSID_SQLOLEAlert

IID_ISQLOLEAlert

AlertSystem

LPSQLOLEALERTSYSTEM

−

−

−

IID_ISQLOLEAlertSystem

Executive

LPSQLOLEEXECUTIVE

−

−

−

IID_ISQLOLEExecutive

IntegratedSecurity

LPSQLOLEINTEGRATEDSECURITY

−

−

−

IID_ISQLOLEIntegratedSecurity

Operator

LPSQLOLEOPERATOR

LPSQLOLEOPERATORS

−

CLSID_SQLOLEOperator

IID_ISQLOLEOperator

Registry

LPSQLOLEREGISTRY

−

−

−

IID_ISQLOLERegistry

Task

LPSQLOLETASK

LPSQLOLETASKS

LPSQLOLETASKLIST

CLSID_SQLOLETask

IID_ISQLOLETask


Application Scope

Application

LPSQLOLEAPPLICATION

−

−

CLSID_SQLOLEApplication

IID_ISQLOLEApplication

Backup

LPSQLOLEBACKUP

−

−

CLSID_SQLOLEBackup

IID_ISQLOLEBackup

HistoryFilter

LPSQLOLEHISTORYFILTER

−

−

CLSID_SQLOLEHistoryFilter

IID_ISQLOLEHistoryFilter

Names

−

LPSQLOLENAMES

LPSQLOLENAMELIST

−

IID_ISQLOLENames

Permission

LPSQLOLEPERMISSION

−

LPSQLOLEPERMISSIONLIST

−

IID_ISQLOLEPermission

QueryResults

LPSQLOLEQUERYRESULTS

−

−

−

IID_ISQLOLEQueryResults


Chapter 3   SQLServer Scope Objects
SQLServer Scope Objects

Configuration Object

ConfigValue Object

Device Object

Language Object

Login Object

RemoteLogin Object

RemoteServer Object

SQLServer Object

SubscriberInfo Object


Configuration Object

Configuration Object     Properties     Methods     Collections

Description

The Configuration object contains a collection of ConfigValue objects. SQL Server configuration options are named values which determine specific SQL Server behavior. Each configuration option has a corresponding object in the ConfigValues collection of the Configuration object. You examine and change a configuration option using the properties of the ConfigValue object. After any configuration option changes are made, you call the ReconfigureCurrentValues or ReconfigureWithOverride method.


Configuration Properties

Configuration Object     Properties     Methods     Collections

Property	Description
Application Application Write: No	The Application object.
Parent SQLServer Write: No	The SQLServer object.
ShowAdvancedOptions Boolean Write: Yes	Determines if advanced configuration options are included in the ConfigValues collection. If True, advanced configuration options are included. If False, advanced configuration options are not included.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Configuration Methods

Configuration Object     Properties     Methods     Collections

ReconfigureCurrentValues

ReconfigureWithOverride


ReconfigureCurrentValues Method

SQLServer.Configuration Object

Description

Accept any and all changes made to SQL Server configuration options. Any changes made to the CurrentValue property of all ConfigValue objects will be accepted by SQL Server. Changes to static configuration options will take effect after SQL Server is stopped and restarted.

Visual Basic

Configuration.ReconfigureCurrentValues

C++

HRESULT pConfiguration->ReconfigureCurrentValues ( );

Reference

RECONFIGURE, sp_configure


ReconfigureWithOverride Method

SQLServer.Configuration Object

Description

Accepts any and all changes made to SQL Server configuration options, ignoring any SQL Server warnings. Any changes made to the CurrentValue property of all ConfigValue objects will be accepted by SQL Server. Changes to static configuration options will take effect after SQL Server is stopped and restarted.

Visual Basic

Configuration.ReconfigureWithOverride

C++

HRESULT pConfiguration->ReconfigureWithOverride ( );

Reference

RECONFIGURE WITH OVERRIDE, sp_configure


Configuration Collections

Configuration Object     Properties     Methods     Collections

Collection	Description
ConfigValues ConfigValues Write: No	The collection of ConfigValue objects.
Parameters Names Write: No	The Names collection that contains command-line parameters passed to SQLSERVR.EXE. Each parameter must include the parameter switch (for example, /e) and the parameter value (for example, C:\SQL60\LOG\ERRORLOG).
Properties Properties Write: No	The collection of Property objects.


ConfigValue Object

ConfigValue Object     Properties     Collections

Description

Each SQL Server configuration option has a corresponding object in the ConfigValues collection of the Configuration object. You examine configuration option details like minimum and maximum value, and change a configuration option value, using the ConfigValue object for that configuration option.


ConfigValue Properties

ConfigValue Object     Properties     Collections

Property	Description
Application Application Write: No	The Application object.
CurrentValue Long Write: Yes	The current value of the configuration option. Set this property to change the current value.
Description String Write: No	A description of this configuration option.
DynamicReconfigure Boolean Write: No	Indicates if a change to the configuration option will take effect immediately when you call the ReconfigureCurrentValues or ReconfigureWithOverride method of the Configuration object. This value is True if the configuration option takes effect immediately, or False if SQL Server must be shut down and restarted.
ID SQLOLE_CONFIGVALUE_TYPE Write: No	The type of configuration value.
MaximumValue Long Write: No	The maximum value of the configuration option.
MinimumValue Long Write: No	The minimum value of the configuration option.
Name String Write: No	The name of this configuration option.
Parent Configuration Write: No	The Configuration object.
RunningValue Long Write: No	The configuration value being used by the running SQL Server.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQLDMO does not use this property.


ConfigValue Collections

ConfigValue Object     Properties     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Device Object

Device Object     Properties     Methods     Lists     Collections

Description

A Device object is pre-allocated physical storage (usually a file on a hard disk) used by SQL Server for storing database information. There are two general types of devices: database devices and dump devices. SQL Server uses database devices to store an entire database, including the transaction log. SQL Server uses dump devices for backup (dump) and restore (load) operations.


Device Properties

Device Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
Default Boolean Write: Yes	Determines if unused space on this database device should be included in the default device pool. When the user creates a new database or extends an existing database, and either does not specify a database device or specifies the default database device, SQL Server uses available device space from the default device pool for database storage. If True, unused space on this device is included in the default device pool. If False, either this device is not included in the default device pool, or this is a dump device.
DeviceNumber Long Write: No	The virtual device number.
FirstPage Long Write: No	The first virtual page number. This property is −1 for dump devices.
LastPage Long Write: No	The last virtual page number. This property is −1 for dump devices.
MirrorName String Write: No	The full path and filename of the mirror device, if any.
MirrorState SQLOLE_MIRROR_TYPE Write: No	The mirror state.
Name Identifier Write: Yes	The name of this device.
Parent SQLServer Write: No	The SQLServer object.
PhysicalLocation String Write: Before Add	The full path and filename of the device storage space.
Size Long Write: Before Add	The size of this device in megabytes.
SkipTapeLabel Boolean Write: Yes	Determines if ANSI tape labels are ignored for dump devices. If True, ANSI tape labels are ignored. If False, either ANSI tape labels are read for dump devices, or this is a database device.
SpaceAvailable Long Write: No	Unused space in megabytes.
Status Long Write:	The status bitmap.
SystemObject Boolean Write: No	Indicates if this is a SQL Server system device. If True, this is a SQL Server system device. If False, this device was created by a user.
Type SQLOLE_DEVICE_TYPE  Write: Yes	The type of the database or dump device.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Device Methods

Device Object     Properties     Methods     Lists     Collections

Mirror

ReadBackupHeader

ReMirror

Remove

SwitchToMirrorDevice

SwitchToMirrorTemp

UnMirrorDevice

UnMirrorTemp


Mirror Method

SQLServer.Device Object

Description

Creates a mirror device for an existing database device.

Visual Basic

Device.Mirror ( [MirrorPathName :=] strMirrorPath )

C++

HRESULT pDevice->Mirror ( SQLOLE_LPCSTR strMirrorPath );

Elements

Element	Type	Description
strMirrorPath	String	Full path and filename of mirror device file
Reference

DISK MIRROR


ReadBackupHeader Method

SQLServer.Device Object

Description

Retrieves the dump header information for a dump device. The dump header contains information about every dump currently stored in the dump device. The dump header information is returned in a QueryResults object.

Visual Basic

QueryResults = Device.ReadBackupHeader

C++

HRESULT pDevice->ReadBackupHeader ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
Dumptype	SQLOLE_DTypeInt2
Database	SQLOLE_DTypeChar
Striped	SQLOLE_DTypeInt2
Compressed	SQLOLE_DTypeInt2
Sequence	SQLOLE_DTypeChar
Volume	SQLOLE_DTypeChar
Devicetype	SQLOLE_DTypeInt2
Table	SQLOLE_DTypeChar
Dumpsize	SQLOLE_DTypeChar
Stripeset	SQLOLE_DTypeChar
Stripeset Name	SQLOLE_DTypeChar
Curseq	SQLOLE_DTypeChar
Newseq	SQLOLE_DTypeChar
CreationDate	SQLOLE_DTypeChar
CreationTime	SQLOLE_DTypeChar
ExpireDate	SQLOLE_DTypeChar
Reference

LOAD HEADERONLY


ReMirror Method

SQLServer.Device Object

Description

Reestablishes disk mirroring for a device. The disk mirroring for this dump device must have been previously (and temporarily) disabled using the SwitchToMirrorTemp or UnMirrorTemp method. Disk mirroring will be reestablished to the same state as it was before being disabled.

Visual Basic

Device.ReMirror

C++

HRESULT pDevice->ReMirror ( );

Reference

DISK REMIRROR


Remove Method

SQLServer.Device Object

Description

Drops the SQL Server database or dump device and removes the Device object. For a database device, if any databases are using any space on the device, the database device cannot be removed.

Visual Basic

Device.Remove

C++

HRESULT pDevice->Remove ( );

Reference

sp_dropdevice


SwitchToMirrorDevice Method

SQLServer.Device Object

Description

Permanently stops disk mirroring for a device. Now only the mirror device is used for storage, permanently becoming the new primary database device. The original primary database device is no longer used.

Visual Basic

Device.SwitchToMirrorDevice

C++

HRESULT pDevice->SwitchToMirrorDevice ( );

Reference

DISK UNMIRROR


SwitchToMirrorTemp Method

SQLServer.Device Object

Description

Temporarily disables disk mirroring for a device. Until the ReMirror method is used, only the mirror device is used for storage, and the primary database device is temporarily disabled. Use the ReMirror method to reestablish disk mirroring.

Visual Basic

Device.SwitchToMirrorTemp

C++

HRESULT pDevice->SwitchToMirrorTemp ( );

Reference

DISK UNMIRROR


UnMirrorDevice Method

SQLServer.Device Object

Description

Permanently disables disk mirroring for a device. Now only the primary database device is used for storage, and the mirror device is no longer used.

Visual Basic

Device.UnMirrorDevice

C++

HRESULT pDevice->UnMirrorDevice ( );

Reference

DISK UNMIRROR


UnMirrorTemp Method

SQLServer.Device Object

Description

Temporarily stops disk mirroring for a device. Until the ReMirror method is used, only the primary database device is used for storage, and the mirror device is temporarily disabled. Use the ReMirror method to reestablish disk mirroring.

Visual Basic

Device.UnMirrorTemp

C++

HRESULT pDevice->UnMirrorTemp ( );

Reference

DISK UNMIRROR


Device Lists

Device Object     Properties     Methods     Lists     Collections

ListDatabases


ListDatabases List

SQLServer.Device Object

Description

Lists the Database objects that use storage space on a device.

Visual Basic

DatabaseList = Device.ListDatabases

C++

HRESULT pDevice->ListDatabases ( LPSQLOLEDATABASELIST* ppDatabaseList );

Elements

Element	Type	Description
DatabaseList	DatabaseList	Returned list of Database objects


Device Collections

Device Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Language Object

Language Object     Properties     Methods     Collections

Description

A Language object contains all the information about each language supported by SQL Server.


Language Object Properties
Language Properties

Language Object     Properties     Methods     Collections

Property	Description
Alias String Write: Yes	Alternate name for the language.
Application Application Write: No	The Application object.
DateFormat String Write: Before Add	Three characters describing the order of the date parts day, month, and year. Valid values include "dmy", "dym", "mdy", "myd", "ydm", and "ymd".
Days String Write: Before Add	Comma-separated list of day full names, in order from Monday through Sunday.
FirstDayOfWeek Integer Write: Before Add	Number of the first day of the week. The numbers 1 through 7 correspond to the days Monday through Sunday respectively.
ID Long Write: No	The language ID.
Months String Write: Before Add	Comma-separated list of month full names, in order from January through December.
Name String Write: Before Add	Official name for the language.
Parent SQLServer Write: No	The SQLServer object.
ShortMonths String Write: Before Add	Comma-separated list of month short names (first three characters), in order from Jan through Dec.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
Upgrade Long Write: No	Version of SQL Server used for most recent upgrade of the language.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Language Object Methods
Language Methods

Language Object     Properties     Methods     Collections

Day

Month

Remove

ShortMonth


Day Method

SQLServer.Language Object

Description

Returns the full name of a day for a language.

Visual Basic

strDay = Language.Day ( [Day :=] iDay )

C++

HRESULT pLanguage->GetDay (
int iDay,
SQLOLE_LPBSTR pstrDay );

Elements

Element	Type	Description
strDay	String	Returned day full name
iDay	Integer	Number of the day where day number 1 is Monday
Remarks

This is an indexed property.

Reference

syslanguages


Month Method

SQLServer.Language Object

Description

Returns the full name of a month for a language.

Visual Basic

strMonth = Language.Month ( [Month :=] iMonth )

C++

HRESULT pLanguage->GetMonth (
int iMonth,
SQLOLE_LPBSTR pstrMonth );

Elements

Element	Type	Description
strMonth	String	Returned month full name
iMonth	Integer	Number of the month where month number 1 is January
Remarks

This is an indexed property.

Reference

syslanguages


Remove Method

SQLServer.Language Object

Description

Drops the SQL Server language and removes the Language object.

Visual Basic

Language.Remove

C++

HRESULT pLanguage->Remove ( );

Reference

sp_droplanguage


ShortMonth Method

SQLServer.Language Object

Description

Returns the short name of a month for a language.

Visual Basic

strShortMonth = Language.ShortMonth ( iMonth )

C++

HRESULT pLanguage->GetShortMonth (
int iMonth,
SQLOLE_LPBSTR pstrShortMonth );

Elements

Element	Type	Description
strShortMonth	String	Returned month short name
iMonth	Integer	Number of the month where month number 1 is January
Remarks

This is an indexed property.

Reference

syslanguages


Language Collections

Language Object     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Login Object

Login Object     Properties     Methods     Lists     Collections

Description

A Login object is a login identifier and password used to connect to SQL Server. A Login object is global to the entire SQL Server, and has corresponding User objects in each database.


Login Properties

Login Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
Database Identifier Write: Yes	The default database used when this login connects to SQL Server.
Language String Write: Yes	The default language used by this login.
ID Long Write: No	The login ID.
Name Identifier Write: Before Add	The login name.
Parent SQLServer Write: No	The SQLServer object.
SystemObject Boolean Write: No	Indicates if this is a SQL Server system login. If True, this is the SA login. If False, this is not the SA login.
TypeOf SQLOLE_OBJECT_TYPE   Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Login Object Methods
Login Methods

Login Object     Properties     Methods     Lists     Collections

AliasName

Remove

Script

SetPassword

UserName


AliasName Method

SQLServer.Login Object

Description

Returns the alias username that a login is associated with for a specific database.

Visual Basic

idAlias = Login.AliasName ( [DatabaseName :=] idDatabase )

C++

HRESULT pLogin->GetAliasName (
SQLOLE_LPCSTR idDatabase,
SQLOLE_LPBSTR pidAlias );

Elements

Element	Type	Description
idAlias	Identifier	Returned alias username
idDatabase	Identifier	Database to retrieve alias username from
Remarks

This is an indexed property.

Reference

sp_addalias


Remove Method

SQLServer.Login Object

Description

Drops the SQL Server login identifier and removes the Login object.

Visual Basic

Login.Remove

C++

HRESULT pLogin->Remove ( );

Reference

sp_droplogin


Script Method

SQLServer.Login Object

Description

Produces a Transact-SQL script that can be used to create the login.

Visual Basic

strSQLScript = Login.Script (
[ScriptType :=] tScriptOptions,
[[ScriptFilePath :=] strFile] )

C++

HRESULT pLogin->Script (
SQLOLE_SCRIPT_TYPE tScriptOptions = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrSQLScript = NULL );

Elements

Element	Type	Description
strSQLScript	String	Returned Transact-SQL script to create the login
tScriptOptions	SQLOLE_SCRIPT_TYPE	Script options
strFile	String	Full path and filename of Transact-SQL script file to create


SetPassword Method

SQLServer.Login Object

Description

Changes the password for this login. Note that because the password is encrypted, there is no way to read it from server.

Visual Basic

Login.SetPassword (
[OldPassword :=] idOldPassword,
[NewPassword :=] idNewPassword )

C++

HRESULT pLogin->SetPassword (
SQLOLE_LPCSTR idOldPassword,
SQLOLE_LPCSTR idNewPassword );

Elements

Element	Type	Description
idOldPassword	Identifier	Old password
idNewPassword	Identifier	New password
Reference

sp_password


UserName Method

SQLServer.Login Object

Description

Returns the user that a login is associated with for a specific database.

Visual Basic

idUser = Login.UserName ( [DatabaseName :=] idDatabase )

C++

HRESULT pLogin->GetUserName (
SQLOLE_LPCSTR idDatabase,
SQLOLE_LPBSTR pidUser );

Elements

Element	Type	Description
idUser	Identifier	Returned username
idDatabase	Identifier	Database to retrieve username from
Remarks

This is an indexed property.

Reference

sp_adduser


Login Lists

Login Object     Properties     Methods     Lists     Collections

ListTasks


ListTasks List

SQLServer.Login Object

Description

Lists the Task objects owned by this login.

Visual Basic

TaskList = Login.ListTasks

C++

HRESULT pLogin->ListTasks ( LPSQLOLETASKLIST* ppTaskList );

Elements

Element	Type	Description
TaskList	TaskList	Returned list of Task objects


Login Collections

Login Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


RemoteLogin Object

RemoteLogin Object     Properties     Methods     Collections

Description

A RemoteLogin object is used when a remote server connects to the local SQL Server. The RemoteLogin specifies the association between a remote login from a specific remote server and a local login. Each RemoteServer object can have multiple RemoteLogin objects.


RemoteLogin Properties

RemoteLogin Object     Properties     Methods     Collections

Property	Description
Application Application Write: No	The Application object.
LocalName Identifier Write: Before Add	The local login used by the local SQL Server. When the remote server connects using this RemoteLogin and the remote login specified by the RemoteName property, the local SQL Server uses this local login.
Parent RemoteServer Write: No	The RemoteServer object.
RemoteName Identifier Write: Before Add	The remote login on the remote server. When the remote server connects using this RemoteLogin, the local SQL Server uses the local login specified by the LocalName property. This is the "Name" property of the RemoteLogins collection.
Trusted Boolean Write: Yes	Determines if the remote password is checked when this RemoteLogin connects to SQL Server. If True, the remote password is checked, and the connection attempt is denied if the remote password does not match the local password. If False, the remote password is not checked, and the connection attempt succeeds.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQLDMO does not use this property.


RemoteLogin Methods

RemoteLogin Object     Properties     Methods     Collections

Remove


Remove Method

SQLServer.RemoteServer.RemoteLogin Object

Description

Drops the SQL Server remote login and removes the RemoteLogin object.

Visual Basic

RemoteLogin.Remove

C++

HRESULT pRemoteLogin->Remove ( );

Reference

sp_dropremotelogin


RemoteLogin Collections

RemoteLogin Object     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


RemoteServer Object

RemoteServer Object     Properties     Methods     Lists     Collections

Description

A RemoteServers object is a remote SQL Server that is known to the local SQL Server.


RemoteServer Properties

RemoteServer Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
ID Long Write: No	The remote server ID.
Name Identifier Write: Before Add	The name of the remote server.
NetName Identifier Write: Yes	The network name of the remote server.
Options SQLOLE_SRVOPTION_TYPE  Write: No	The bitmap of remote server options that are currently enabled.
Parent SQLServer Write: No	The SQLServer object.
SubscriberInfo SubscriberInfo Write: No	The SubscriberInfo object.
TopologyX Long Write: No	Reserved.
TopologyY Long Write: No	Reserved.
TypeOf  SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	The temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


RemoteServer Methods

RemoteServer Object     Properties     Methods     Lists     Collections

BeginAlter

CancelAlter

DoAlter

ExecuteImmediate

ExecuteWithResults

Refresh

Remove

SetOptions

SetTopologyXY

Subscribe

UnSubscribe


BeginAlter Method

SQLServer.RemoteServer Object

Description

Marks the start of a single unit of changes to RemoteServer properties. Normally, each change to a single property is a separate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

RemoteServer.BeginAlter

C++

HRESULT pRemoteServer->BeginAlter ( );


DoAlter Method

SQLServer.RemoteServer Object

Description

Stops a unit of RemoteServer property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

RemoteServer.CancelAlter

C++

HRESULT pRemoteServer->CancelAlter ( );


CancelAlter Method

SQLServer.RemoteServer Object

Description

Commits a unit of RemoteServer property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

RemoteServer.DoAlter

C++

HRESULT pRemoteServer->DoAlter ( );


ExecuteImmediate Method

SQLServer.RemoteServer Object

Description

Executes a Transact-SQL statement on a remote server. No results are returned to the application.

Visual Basic

RemoteServer.ExecuteImmediate ( [Command :=] strSQLStatement )

C++

HRESULT pRemoteServer->ExecuteImmediate ( SQLOLE_LPCSTR strSQLStatement );

Elements

Element	Type	Description
strSQLStatement	String	SQL statement
Reference

sp_sqlexec


ExecuteWithResults Method

SQLServer.RemoteServer Object

Description

Executes a Transact-SQL statement on a remote server. Returns results in a QueryResults object.

Visual Basic

QueryResults = RemoteServer.ExecuteWithResults ( [Command :=] strSQLStatement )

C++

HRESULT pRemoteServer->ExecuteWithResults (
SQLOLE_LPCSTR strSQLStatement,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
strSQLStatement	String	SQL statement
QueryResults

The contents of the QueryResults object depend on the TransactSQL statement.

Reference

sp_sqlexec


Refresh Method

SQLServer.RemoteServer Object

Description

Updates RemoteServer properties with current values from SQL Server.

Visual Basic

RemoteServer.Refresh

C++

HRESULT pRemoteServer->Refresh ( );


Remove Method

SQLServer.RemoteServer Object

Description

Drops the SQL Server remote server and removes the RemoteServer object.

Visual Basic

RemoteServer.Remove

C++

HRESULT pRemoteServer->Remove ( );

Reference

sp_dropserver


SetOptions Method

SQLServer.RemoteServer Object

Description

Changes server options for a remote server.

Visual Basic

RemoteServer.SetOptions (
[Options :=] tServerOptions,
[Setting :=] bSetting )

C++

HRESULT pRemoteServer->SetOptions (
SQLOLE_SRVOPTION_TYPE tServerOptions,
BOOL bSetting );

Elements

Element	Type	Description
tServerOptions	SQLOLE_SRVOPTION_TYPE	Bitmap of server options to set
bSetting	Boolean	New setting for all the specified options
Reference

sp_serveroption


SetTopologyXY Method

SQLServer.RemoteServer Object

Description

Reserved. Do not use this method.

Visual Basic

RemoteServer.SetTopologyXY (
[X :=] lX,
[Y :=] lY )

C++

HRESULT pRemoteServer->SetSetTopologyXY (
long lX,
long lY );

Elements

Element	Type	Description
lX	Long	X value
lY	Long	Y value


Subscribe Method

SQLServer.RemoteServer Object

Description

Subscribes to a publication on a remote server.

Visual Basic

RemoteServer.Subscribe (
[DatabaseName :=] idPubDatabase,
[PublicationName :=] idPublication,
[[ArticleName :=] idArticle,]
[[SubscribingDB :=] idSubDatabase,]
[[SyncType :=] tSync] )

C++

HRESULT pRemoteServer->Subscribe (
SQLOLE_LPCSTR idPubDatabase,
SQLOLE_LPCSTR idPublication,
SQLOLE_LPCSTR idArticle = NULL,
SQLOLE_LPCSTR idSubDatabase = NULL,
SQLOLE_SUBSYNC_TYPE tSync = SQLOLESubSync_Auto );

Elements

Element	Type	Description
idPubDatabase	Identifier	Database on the remote server that is publishing the article.
idPublication	Identifier	Publication that contains the article.
idArticle	Identifier	Article to subscribe to. Default is all articles.
idSubDatabase	Identifier	Destination database on the local server that is subscribing to the article. Default is the same database as idPubDatabase.
tSync	SQLOLE_SUBSYNC_TYPE	Synchronization type.
Reference

sp_subscribe


UnSubscribe Method

SQLServer.RemoteServer Object

Description

Stops an existing subscription from a remote server.

Visual Basic

RemoteServer.UnSubscribe (
[DatabaseName :=] idPubDatabase,
[[PublicationName :=] idPublication,]
[[ArticleName :=] idArticle] )

C++

HRESULT pRemoteServer->UnSubscribe (
SQLOLE_LPCSTR idPubDatabase,
SQLOLE_LPCSTR idPublication = NULL,
SQLOLE_LPCSTR idArticle = NULL );

Elements

Element	Type	Description
idPubDatabase	Identifier	Database on the remote server that is publishing the article.
idPublication	Identifier	Publication that contains the article. Default is all publications.
idArticle	Identifier	Article in publication to unsubscribe from. Default is all articles.
Reference

sp_unsubscribe


RemoteServer Lists

RemoteServer Object     Properties     Methods     Lists     Collections

EnumArticles

EnumPublicationDatabases

EnumPublications

EnumPublicationSyncTask

EnumSubscriptionDatabases

EnumSubscriptions

EnumTasks


EnumArticles List

SQLServer.RemoteServer Object

Description

Lists the articles contained in the specified publication and database for a remote server. List is returned in a QueryResults object.

Visual Basic

QueryResults = RemoteServer.EnumArticles (
[DatabaseName :=] idPubDatabase,
[PublicationName :=] idPublication )

C++

HRESULT pRemoteServer->EnumArticles (
SQLOLE_LPCSTR idPubDatabase,
SQLOLE_LPCSTR idPublication,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
idPubDatabase	Identifier	Database on the remote server that contains the publication
idPublication	Identifier	Publication that contains the articles to list
QueryResults

ColumnName	ColumnType
article id	SQLOLE_DTypeInt4
article name	SQLOLE_DTypeChar
base table	SQLOLE_DTypeChar
destination table	SQLOLE_DTypeChar
synchronization object	SQLOLE_DTypeChar
type	SQLOLE_DTypeInt1
status	SQLOLE_DTypeInt1
filter	SQLOLE_DTypeChar
description	SQLOLE_DTypeChar
insert_command	SQLOLE_DTypeChar
update_command	SQLOLE_DTypeChar
delete_command	SQLOLE_DTypeChar
creation script path	SQLOLE_DTypeChar
vertical partition	SQLOLE_DTypeBit
pre_creation_cmd	SQLOLE_DTypeInt1
filter_clause	SQLOLE_DTypeText


EnumPublicationDatabases List

SQLServer.RemoteServer Object

Description

Lists the databases on a remote server which can publish articles. List is returned in a QueryResults object.

Visual Basic

QueryResults = RemoteServer.EnumPublicationDatabases

C++

HRESULT pRemoteServer->EnumPublicationDatabases (
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar


EnumPublications List

SQLServer.RemoteServer Object

Description

Lists publications of the specified database on a remote server. List is returned in a QueryResults object.

Visual Basic

QueryResults = RemoteServer.EnumPublications ( [DatabaseName :=] idPubDatabase )

C++

HRESULT pRemoteServer->EnumPublications (
SQLOLE_LPCSTR idPubDatabase,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
idPubDatabase	Identifier	Database on the remote server that contains the publication
QueryResults

ColumnName	ColumnType
pubid	SQLOLE_DTypeInt4
name	SQLOLE_DTypeChar
restricted	SQLOLE_DTypeBit
status	SQLOLE_DTypeInt1
task	SQLOLE_DTypeInt4
replication frequency	SQLOLE_DTypeInt1
synchronization method	SQLOLE_DTypeInt1
description	SQLOLE_DTypeChar


EnumPublicationSyncTask List

SQLServer.RemoteServer Object

Description

Returns information about a scheduled synchronization task for a publication and database on a remote server. The synchronization task information is returned in a QueryResults object.

Visual Basic

QueryResults = RemoteServer.EnumPublicationSyncTask (
[DatabaseName :=] idPubDatabase,
[PublicationName :=] idPublication )

C++

HRESULT pRemoteServer->EnumPublicationSyncTask (
SQLOLE_LPCSTR idPubDatabase,
SQLOLE_LPCSTR idPublication,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
idPubDatabase	Identifier	Database on the remote server that contains the publication
idPublication	Identifier	Publication
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar
id	SQLOLE_DTypeInt4
subsystem	SQLOLE_DTypeChar
server	SQLOLE_DTypeChar
username	SQLOLE_DTypeChar
ownerloginname	SQLOLE_DTypeChar
databasename	SQLOLE_DTypeChar
enabled	SQLOLE_DTypeInt1
freqtype	SQLOLE_DTypeInt4
freqinterval	SQLOLE_DTypeInt4
freqsubtype	SQLOLE_DTypeInt4
freqsubinterval	SQLOLE_DTypeInt4
freqrelativeinterval	SQLOLE_DTypeInt4
freqrecurrencefactor	SQLOLE_DTypeInt4
activestartdate	SQLOLE_DTypeInt4
activeenddate	SQLOLE_DTypeInt4
activestarttimeofday	SQLOLE_DTypeInt4
activeendtimeofday	SQLOLE_DTypeInt4
lastrundate	SQLOLE_DTypeInt4
lastruntime	SQLOLE_DTypeInt4
nextrundate	SQLOLE_DTypeInt4
nextruntime	SQLOLE_DTypeInt4
runpriority	SQLOLE_DTypeInt4
emailoperatorname	SQLOLE_DTypeChar
retryattempts	SQLOLE_DTypeInt4
retrydelay	SQLOLE_DTypeInt4
datecreated	SQLOLE_DTypeDateTime
datemodified	SQLOLE_DTypeDateTime
command	SQLOLE_DTypeChar
lastruncompletionlevel	SQLOLE_DTypeInt4
lastrunduration	SQLOLE_DTypeInt4
lastrunretries	SQLOLE_DTypeInt4
loghistcompletionlevel	SQLOLE_DTypeInt4
emailcompletionlevel	SQLOLE_DTypeInt4
description	SQLOLE_DTypeChar
tagadditionalinfo	SQLOLE_DTypeChar
tagobjectid	SQLOLE_DTypeInt4
tagobjecttype	SQLOLE_DTypeInt4
Reference

sp_helppublicationsync


EnumSubscriptionDatabases List

SQLServer.RemoteServer Object

Description

Lists the databases on a remote server that can subscribe to articles. List is returned in a QueryResults object.

Visual Basic

QueryResults = RemoteServer.EnumSubscriptionDatabases

C++

HRESULT pRemoteServer->EnumSubscriptionDatabases ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar
Reference

sp_helpsubscription


EnumSubscriptions List

SQLServer.RemoteServer Object

Description

Lists subscriptions to the specified article on a remote server. List is returned in a QueryResults object.

Visual Basic

QueryResults = RemoteServer.EnumSubscriptions (
[DatabaseName :=] idPubDatabase,
[PublicationName :=] idPublication,
[ArticleName :=] idArticle )

C++

HRESULT pRemoteServer->EnumSubscriptions (
SQLOLE_LPCSTR idPubDatabase,
SQLOLE_LPCSTR idPublication,
SQLOLE_LPCSTR idArticle,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
idPubDatabase	Identifier	Database on the remote server that is publishing the article
idPublication	Identifier	Publication that contains the article
idArticle	Identifier	Article
QueryResults

ColumnName	ColumnType
subscriber	SQLOLE_DTypeChar
publication	SQLOLE_DTypeChar
article	SQLOLE_DTypeChar
destination database	SQLOLE_DTypeChar
subscription status	SQLOLE_DTypeInt1
synchronization type	SQLOLE_DTypeInt1
Reference

sp_helpsubscription


EnumTasks List

SQLServer.RemoteServer Object

Description

Lists tasks on a remote server. List is returned in a QueryResults object.

Visual Basic

QueryResults = RemoteServer.EnumTasks (
[[TaskName :=] idTaskName,]
[[TaskID :=] nTaskID] )

C++

HRESULT pRemoteServer->EnumTasks (
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR idTaskName = NULL,
long nTaskID = 0 );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
idTaskName	Identifier	Name of the task
nTaskID	Long	Task ID
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar
id	SQLOLE_DTypeInt4
subsystem	SQLOLE_DTypeChar
server	SQLOLE_DTypeChar
username	SQLOLE_DTypeChar
ownerloginname	SQLOLE_DTypeChar
databasename	SQLOLE_DTypeChar
enabled	SQLOLE_DTypeInt1
freqtype	SQLOLE_DTypeInt4
freqinterval	SQLOLE_DTypeInt4
freqsubtype	SQLOLE_DTypeInt4
freqsubinterval	SQLOLE_DTypeInt4
freqrelativeinterval	SQLOLE_DTypeInt4
freqrecurrencefactor	SQLOLE_DTypeInt4
activestartdate	SQLOLE_DTypeInt4
activeenddate	SQLOLE_DTypeInt4
activestarttimeofday	SQLOLE_DTypeInt4
activeendtimeofday	SQLOLE_DTypeInt4
lastrundate	SQLOLE_DTypeInt4
lastruntime	SQLOLE_DTypeInt4
nextrundate	SQLOLE_DTypeInt4
nextruntime	SQLOLE_DTypeInt4
runpriority	SQLOLE_DTypeInt4
emailoperatorname	SQLOLE_DTypeChar
retryattempts	SQLOLE_DTypeInt4
retrydelay	SQLOLE_DTypeInt4
datecreated	SQLOLE_DTypeDateTime
datemodified	SQLOLE_DTypeDateTime
command	SQLOLE_DTypeChar
lastruncompletionlevel	SQLOLE_DTypeInt4
lastrunduration	SQLOLE_DTypeInt4
lastrunretries	SQLOLE_DTypeInt4
loghistcompletionlevel	SQLOLE_DTypeInt4
emailcompletionlevel	SQLOLE_DTypeInt4
description	SQLOLE_DTypeChar
tagadditionalinfo	SQLOLE_DTypeChar
tagobjectid	SQLOLE_DTypeInt4
tagobjecttype	SQLOLE_DTypeInt4
Reference

sp_helptask


RemoteServer Collections

RemoteServer Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.
RemoteLogins RemoteLogins Write: No	The collection of RemoteLogin objects.


SQLServer Object

SQLServer Object     Properties     Methods     Lists     Collections

Description

The SQLServer object is the top level object for the SQL Server OLE object model. All other SQL-DMO objects are either contained within or accessed through a SQLServer object.

A SQLServer object is associated with a single SQL Server, and contains a single connection to that SQL Server. You use the Connect method to establish a connection to SQL Server.


SQLServer Object Properties

SQLServer Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
ApplicationName String Write: Before Connect	The name of the application. Supplied by the application. This property can be changed after a DisConnect and before a ReConnect.
AutoReConnect Type: Boolean Write: Yes	Determines if SQL-DMO will automatically reestablish broken connections. If True, a connection broken before an operation will be reconnected automatically. If False, broken connections are not reconnected automatically.
CommandTerminator String Write: Yes	The Transact-SQL command terminator. The default is "go".
Configuration Configuration Write: No	The Configuration object for this SQLServer.
ConnectionID Long Write: No	The SQL-DMO connection ID unique for this SQL-DMO instance.
DistributionDatabase String Write: No	The replication distribution database.
DistributionServer String Write: No	The replication distribution server.
DistributionWorkingDirectory String Write: Yes	The replication distribution working directory.
Executive Executive Write: No	The Executive object for this SQL Server.
HostName String Write: Before Connect	The name of the client computer. Supplied by the application. This property can be changed after calling DisConnect and before calling ReConnect.
IntegratedSecurity IntegratedSecurity Write: No	The IntegratedSecurity object.
Language String Write: Yes	The Language used by the SQL Server.
Login Identifier Write: Before Connect	The login ID used to connect to SQL Server. Supplied by the application.
LoginSecure Boolean Write: Before Connect	Determines if a secure connection is requested when the Connect method is called. If True, a secure connection is requested. If False, a normal connection is requested.
LoginTimeout Long Write: Before Connect	The number of seconds to wait for a connection attempt to succeed. The default is −1 which means 60 seconds. A value of 0 means no timeout.
MaxNumericPrecision Long Write: No	The maximum precision available for exact numeric datatypes, including decimal and numeric.
Name String Write: Before Connect	The name of the SQL Server. Supplied by the application.
NetPacketSize Long Write: Before Connect	The network packet size in bytes. The default is 0 which means 4096 bytes.
NextDeviceNumber Long Write: No	The next available device number. The maximum device number is 256.
Parent Application Write: No	The Application object.
Password Identifier Write: Before Connect	The password used to connect to SQL Server. Supplied by the application.
ProcessID Long Write: No	The SQL Server process ID of the connection used by the SQLServer object.
QueryTimeout Long Write: Yes	The number of seconds to wait for a query execution attempt to begin returning results. The default is −1 which means no timeout. A value of  0 also means no timeout.
Registry Registry Write: No	The Registry object for this SQL Server.
SaLogin Boolean Write: No	Indicates if the login used for the connection has system administrator (SA) privilege.
Status SQLOLE_SVCSTATUS_TYPE  Write: No	The service status of the SQL Server.
TrueLogin Identifier Write: No	The real login used of the connection to SQL Server. This may be different than Login for a secure connection.
TrueName Identifier Write: No	The name of the SQL Server stored in @@servername.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.
UserProfile SQLOLE_SRVUSERPROFILE_TYPE  Write: No	The SQL Server profile information for the currently connected user.
VersionMajor Long Write: No	The SQL Server version number to the left of the decimal point.
VersionMinor Long Write: No	The SQL Server version number to the right of the decimal point.
VersionString String Write: No	The version of the SQL Server stored in @@version.


SQLServer Methods

SQLServer Object     Properties     Methods     Lists     Collections

BeginTransaction

Close

CommandShellImmediate

CommandShellWithResults

CommitTransaction

Connect

Continue

DisConnect

ExecuteImmediate

ExecuteWithResults

KillDatabase

KillProcess

Pause

ProcessInputBuffer

ProcessOutputBuffer

PurgeHistory

ReadBackupHeader

ReadErrorLog

ReConnect

RemoveSubscriberSubscriptions

RollbackTransaction

SaveTransaction

Start

StatusInfoRefetchInterval

ShutDown

UnloadODSDLL

VerifyConnection


BeginTransaction Method

SQLServer Object

Description

Begins a transaction.

Visual Basic

SQLServer.BeginTransaction ( [[TransactionName :=] idTransaction] )

C++

HRESULT pSQLServer->BeginTransaction ( SQLOLE_LPCSTR idTransaction = NULL );

Elements

Element	Type	Description
idTransaction	Identifier	Transaction name
Reference

BEGIN TRANSACTION


Close Method

SQLServer Object

Description

Disconnects from SQL Server and closes the SQLServer object.

Visual Basic

SQLServer.Close

C++

HRESULT pSQLServer->Close ( );


CommandShellImmediate Method

SQLServer Object

Description

Executes an operating system command. Output from the command is not returned.

Visual Basic

SQLServer.CommandShell ( [Command :=] strCommand )

C++

HRESULT pSQLServer->CommandShell ( SQLOLE_LPCSTR
strCommand );

Elements

Element	Type	Description
strCommand	String	Operating system command
Reference

xp_cmdshell


CommandShellWithResults Method

SQLServer Object

Description

Executes an operating system command. Output from the command is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.CommandShellWithResults ( [Command :=] strCommand )

C++

HRESULT pSQLServer->CommandShellWithResults (
SQLOLE_LPCSTR strCommand,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
strCommand	String	Operating system command
Remarks

The contents of the QueryResults object depend on the operating system command.

Reference

xp_cmdshell


CommitTransaction Method

SQLServer Object

Description

Commits an open transaction.

Visual Basic

SQLServer.CommitTransaction ( [[TransactionName :=] idTransaction] )

C++

HRESULT pSQLServer->CommitTransaction ( SQLOLE_LPCSTR idTransaction = NULL );

Elements

Element	Type	Description
idTransaction	Identifier	Transaction name
Reference

COMMIT TRANSACTION


Connect Method

SQLServer Object

Description

Connects to SQL Server.

Visual Basic

SQLServer.Connect (
[[ServerName :=] strServer,]
[[Login :=] idLogin,]
[[Password :=] idPassword] )

C++

HRESULT pSQLServer->Connect (
SQLOLE_LPCSTR strServer = NULL,
SQLOLE_LPCSTR idLogin = NULL,
SQLOLE_LPCSTR idPassword = NULL );

Elements

Element	Type	Description
strServer	String	Name of SQL Server
idLogin	Identifier	Login
idPassword	Identifier	Password


Continue Method

SQLServer Object

Description

Continues a paused SQL Server.

Visual Basic

SQLServer.Continue

C++

HRESULT pSQLServer->Continue ( );


DisConnect Method

SQLServer Object

Description

Disconnects from SQL Server.

Visual Basic

SQLServer.DisConnect

C++

HRESULT pSQLServer->DisConnect ( );


ExecuteImmediate Method

SQLServer Object

Description

Executes a Transact-SQL statement on a SQL Server. No results are returned to the application.

Visual Basic

SQLServer.ExecuteImmediate (
[Command :=] strSQLStatement,
[[ExecType :=] tExecOption] )

C++

HRESULT pSQLServer->ExecuteImmediate (
SQLOLE_LPCSTR strSQLStatement,
SQLOLE_EXEC_TYPE tExecOption = SQLOLEExec_Default );

Elements

Element	Type	Description
strSQLStatement	String	SQL statement
tExecOption	SQLOLE_EXEC_TYPE	Options for executing this SQL statement
Reference

EXECUTE


ExecuteWithResults Method

SQLServer Object

Description

Executes a Transact-SQL statement on a SQL Server. Returns results in a QueryResults object.

Visual Basic

QueryResults = SQLServer.ExecuteWithResults ( [Command :=] strSQLStatement )

C++

HRESULT pSQLServer->ExecuteWithResults (
SQLOLE_LPCSTR strSQLStatement,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
strSQLStatement	String	SQL statement
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar
Reference

EXECUTE


KillDatabase Method

SQLServer Object

Description

Removes a damaged database. Use this when Database.Remove fails.

Visual Basic

SQLServer.KillDatabase ( [DatabaseName :=] idDatabase )

C++

HRESULT pSQLServer->KillDatabase ( SQLOLE_LPCSTR idDatabase );

Elements

Element	Type	Description
idDatabase	Identifier	Database name
Reference

DBCC DBREPAIR


KillProcess Method

SQLServer Object

Description

Terminates a SQL Server process.

Visual Basic

SQLServer.KillProcess ( [ProcessID :=] lProcess )

C++

HRESULT pSQLServer->KillProcess ( long lProcess );

Elements

Element	Type	Description
lProcess	Long	SQL Server process ID
Remarks

A SQLServer object cannot use KillProcess to terminate its own connection.

Reference

KILL


Pause Method

SQLServer Object

Description

Pauses a running SQL Server.

Visual Basic

SQLServer.Pause

C++

HRESULT pSQLServer->Pause ( );


ProcessInputBuffer Method

SQLServer Object

Description

Retrieves the SQL Server input buffer for a SQL Server process.

Visual Basic

strInputBuffer = SQLServer.ProcessInputBuffer ( [ProcessID :=] lProcess )

C++

HRESULT pSQLServer->GetProcessInputBuffer (
long lProcess,
SQLOLE_LPBSTR pstrInputBuffer );

Elements

Element	Type	Description
strInputBuffer	String	Returned SQL Server input buffer
lProcess	Long	SQL Server process
Remarks

This is an indexed property.

Reference

DBCC INPUTBUFFER


ProcessOutputBuffer Method

SQLServer Object

Description

Retrieves the SQL Server output buffer for a SQL Server process.

Visual Basic

strOutputBuffer = SQLServer.ProcessOutputBuffer ( [ProcessID :=] lProcess )

C++

HRESULT pSQLServer->GetProcessOutputBuffer (
long lProcess,
SQLOLE_LPBSTR pstrOutputBuffer );

Elements

Element	Type	Description
strOutputBuffer	String	Returned SQL Server output buffer
lProcess	Long	SQL Server process
Remarks

This is an indexed property.

Reference

DBCC OUTPUTBUFFER


PurgeHistory Method

SQLServer Object

Description

Removes information from the task history log. Set the properties of a created HistoryFilter object as desired and pass it to the PurgeHistory method.

Visual Basic

SQLServer.PurgeHistory ( [[HistoryFilter :=] HistoryFilter] )

C++

HRESULT pSQLServer->PurgeHistory ( LPSQLOLEHISTORYFILTER HistoryFilter = NULL );

Elements

Element	Type	Description
HistoryFilter	HistoryFilter	HistoryFilter object
Remarks

Only the system administrator can purge history information for tasks owned by other users.

Reference

sp_purgehistory


ReadBackupHeader Method

SQLServer Object

Description

Retrieves the dump header information for a Backup object. The dump header contains information about every dump currently stored in the dump device. The dump header information is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.ReadBackupHeader ( [LoadSpec :=] Backup )

C++

HRESULT pSQLServer->ReadBackupHeader (
LPSQLOLEBACKUP Backup,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
Backup	Backup	Backup object containing the backup specifications
QueryResults

ColumnName	ColumnType
Dumptype	SQLOLE_DTypeInt2
Database	SQLOLE_DTypeChar
Striped	SQLOLE_DTypeInt2
Compressed	SQLOLE_DTypeInt2
Sequence	SQLOLE_DTypeChar
Volume	SQLOLE_DTypeChar
Devicetype	SQLOLE_DTypeInt2
Table	SQLOLE_DTypeChar
Dumpsize	SQLOLE_DTypeChar
Stripeset	SQLOLE_DTypeChar
Stripeset Name	SQLOLE_DTypeChar
Curseq	SQLOLE_DTypeChar
Newseq	SQLOLE_DTypeChar
CreationDate	SQLOLE_DTypeChar
CreationTime	SQLOLE_DTypeChar
ExpireDate	SQLOLE_DTypeChar
Reference

LOAD HEADERONLY


ReadErrorLog Method

SQLServer Object

Description

Reads the specified SQL Server error log. Returns results in a QueryResult object.

Visual Basic

QueryResults = SQLServer.ReadErrorLog ( [[LogNumber :=] lLogNumber] )

C++

HRESULT pSQLServer->ReadErrorLog (
LPSQLOLEQUERYRESULTS* ppQueryResults,
long lLogNumber = 0 );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
lLogNumber	Long	Log number
QueryResults

ColumnName	ColumnType
C:\SQL60\LOG\ERRORLOG	SQLOLE_DTypeChar


ReConnect Method

SQLServer Object

Description

Reestablishes a connection to SQL Server that was previously closed using DisConnect.

Visual Basic

SQLServer.ReConnect

C++

HRESULT pSQLServer->ReConnect ( );


RemoveSubscriberSubscriptions Method

SQLServer Object

Description

Removes subscriptions for a subscriber from this SQL Server.

Visual Basic

SQLServer.RemoveSubscriberSubscriptions (
[Subscriber :=] idSubServer,
[[SourceDatabase :=] idDatabase] )

C++

HRESULT pSQLServer->RemoveSubscriberSubscriptions (
SQLOLE_LPCSTR idSubServer,
SQLOLE_LPCSTR SourceDatabase = NULL );

Elements

Element	Type	Description
idSubServer	Identifier	Subscriber SQL Server.
idDatabase	Identifier	Database to remove subscriptions from. Default is all databases.


RollbackTransaction Method

SQLServer Object

Description

Rolls back an open transaction.

Visual Basic

SQLServer.RollbackTransaction ( [[TransactionOrSavepointName :=] idTransactionOrSavepoint] )

C++

HRESULT pSQLServer->RollbackTransaction ( SQLOLE_LPCSTR idTransactionOrSavepoint = NULL );

Elements

Element	Type	Description
idTransactionOrSavepoint	Identifier	The transaction name
Reference

ROLLBACK TRANSACTION


SaveTransaction Method

SQLServer Object

Description

Sets a savepoint within an open transaction.

Visual Basic

SQLServer.SaveTransaction ( [SavepointName :=] idSavepoint )

C++

HRESULT pSQLServer->SaveTransaction ( SQLOLE_LPCSTR
idSavepoint );

Elements

Element	Type	Description
idSavepoint	Identifier	The savepoint name
Reference

SAVE TRANSACTION


Start Method

SQLServer Object

Description

Starts a stopped SQL Server.

Visual Basic

SQLServer.Start (
[[Server :=] strServer,]
[[Login :=] idLogin,]
[[Password :=] idPassword,]
[[MasterDBPath :=] strMasterDatabasePath,]
[[ErrorLogPath :=] strErrorLogPath,]
[[MasterMirrorPath :=] strMasterMirrorPath,]
[[StartMode :=] tStartMode] )

C++

HRESULT pSQLServer->Start (
SQLOLE_LPCSTR strServer = NULL,
SQLOLE_LPCSTR idLogin = NULL,
SQLOLE_LPCSTR idPassword = NULL,
SQLOLE_LPCSTR strMasterDatabasePath = NULL,
SQLOLE_LPCSTR strErrorLogPath = NULL,
SQLOLE_LPCSTR strMasterMirrorPath = NULL,
SQLOLE_STARTSRV_TYPE tStartMode = SQLOLEStart_Defaults );

Elements

Element	Type	Description
strServer	String	Name of SQL Server to start
idLogin	Identifier	Login
idPassword	Identifier	Password
strMasterDatabasePath	String	Path to master database
strErrorLogPath	String	Path to error log
strMasterMirrorPath	String	Path to master mirror
tStartMode	SQLOLE_STARTSRV_TYPE	Start mode


StatusInfoRefetchInterval Method
StatusInfoRefetchInterval

SQLServer Object

Description

Gets or sets the refetch interval for retrieiving the Status and SpaceAvailable properties for all Database objects in the SQLServer.Databases collection.

Visual Basic

lRefetchInterval = SQLServer.StatusInfoRefetchInterval ( [StatusInfoType :=] tStatusInfo )

SQLServer.StatusInfoRefetchInterval ( [StatusInfoType :=] tStatusInfo ) = lRefetchInterval

C++

HRESULT pSQLServer->GetStatusInfoRefetchInterval (
SQLOLE_STATUSINFO_TYPE tStatusInfo,
LPLONG plRefetch );

HRESULT pSQLServer->SetStatusInfoRefetchInterval (
SQLOLE_STATUSINFO_TYPE tStatusInfo,
long lRefetch );

Elements

Element	Type	Description
lRefetchInterval	Long	Refetch interval in seconds
tStatusInfo	SQLOLE_STATUSINFO_TYPE	Status information to set or get
Remarks

When the Status and SpaceAvailable properties are retrieved for one Database object, SQL-DMO retrieves and caches these properties for all Databases. If you get one of these properties within lRefetchInterval seconds after the last retrieval, the information from the cache will be used. If you get one of these properties more than lRefetchInterval seconds after the last retrieval, these properties of all Databases will be retrieved from SQL Server again. Setting lRefetchInterval to 0 disables this behavior. The default is 30 seconds.

This is an indexed property.


ShutDown Method

SQLServer Object

Description

Stops a running SQL Server.

Visual Basic

SQLServer.ShutDown ( [[Wait :=] bWait] )

C++

HRESULT pSQLServer->ShutDown ( BOOL bWait = TRUE );

Elements

Element	Type	Description
bWait	Boolean	If True, SQL Server waits for current operations to complete before stopping. If False, SQL Server stops immediately.
Reference

SHUTDOWN


UnloadODSDLL Method

SQLServer Object

Description

Unloads an Open Data Services DLL, such as an extended stored procedure DLL, from SQL Server memory.

Visual Basic

SQLServer.UnloadODSDLL ( [DLLName :=] strDLL )

C++

HRESULT pSQLServer->UnloadODSDLL ( SQLOLE_LPCSTR strDLL );

Elements

Element	Type	Description
strDLL	String	Open Data Services DLL file
Reference

DBCC dllname(FREE)


VerifyConnection Method

SQLServer Object

Description

Returns the state of a connection or a connection verification option.

Visual Basic

bStatus = SQLServer->VerifyConnection ( [[ReconnectIfDead :=]
tVerifyType] )

C++

HRESULT pSQLServer->VerifyConnection (
LPBOOL pbStatus,
SQLOLE_VERIFYCONN_TYPE tVerifyType = SQLOLEConn_ReconnectIfDead );

Elements

Element	Type	Description
bStatus	Boolean	Indicates the status of the tVerifyType value. If True, the connection is valid or the option is enabled. If False, the indicated connection is broken or the option is disabled.
tVerifyType	SQLOLE_VERIFYCONN_TYPE	Connection status or connection verification option.


SQLServer Lists

SQLServer Object     Properties     Methods     Lists     Collections

EnumAvailableMedia

EnumDirectories

EnumErrorLogs

EnumHistory

EnumLocks

EnumProcesses

EnumPublicationDatabases

EnumServerAttributes

EnumSubscriberSubscriptions

EnumSubscriptionDatabases

EnumVersionInfo

ListStartupProcedures


EnumAvailableMedia List

SQLServer Object

Description

Lists available media. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumAvailableMedia ( [[MediaType :=] tMedia] )

C++

HRESULT pSQLServer->EnumAvailableMedia (
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_MEDIA_TYPE tMedia = SQLOLEMedia_All );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
tMedia	SQLOLE_MEDIA_TYPE	Media type
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar
low free	SQLOLE_DTypeInt4
high free	SQLOLE_DTypeInt4
media type	SQLOLE_DTypeInt1


EnumDirectories List

SQLServer Object

Description

Lists directories on the SQL Server computer. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumDirectories ( [PathName :=] strPath )

C++

HRESULT pSQLServer->EnumDirectories (
SQLOLE_LPCSTR strPath,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
strPath	String	Path name
QueryResults

ColumnName	ColumnType
subdirectory	SQLOLE_DTypeChar


EnumErrorLogs List

SQLServer Object

Description

Lists SQL Server error logs. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumErrorLogs

C++

HRESULT pSQLServer->EnumErrorLogs ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
Archive #	SQLOLE_DTypeInt4
Date	SQLOLE_DTypeChar


EnumHistory List

SQLServer Object

Description

Lists SQL Server task history. List is returned in a QueryResults object. Set the properties of a created HistoryFilter object as desired and pass it to the EnumHistory method.

Visual Basic

QueryResults = SQLServer.EnumHistory ( [[HistoryFilter :=] HistoryFilter] )

C++

HRESULT pSQLServer->EnumHistory (
LPSQLOLEQUERYRESULTS* ppQueryResults,
LPSQLOLEHISTORYFILTER HistoryFilter = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
HistoryFilter	HistoryFilter	HistoryFilter object
QueryResults

ColumnName	ColumnType
id	SQLOLE_DTypeInt4
eventid	SQLOLE_DTypeInt4
messageid	SQLOLE_DTypeInt4
severity	SQLOLE_DTypeInt4
taskname	SQLOLE_DTypeChar
source	SQLOLE_DTypeChar
category	SQLOLE_DTypeChar
runstatus	SQLOLE_DTypeInt4
rundate	SQLOLE_DTypeInt4
runtime	SQLOLE_DTypeInt4
runduration	SQLOLE_DTypeInt4
reviewstatus	SQLOLE_DTypeChar
emailoperatorname	SQLOLE_DTypeChar
retries	SQLOLE_DTypeInt4
comments	SQLOLE_DTypeChar
timesskipped	SQLOLE_DTypeInt4
Reference

sp_helphistory


EnumLocks List

SQLServer Object

Description

Lists the locks held by a SQL Server process. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumLocks ( [[WhoByID :=] lProcess] )

C++

HRESULT pSQLServer->EnumLocks (
LPSQLOLEQUERYRESULTS* ppQueryResults,
long lProcess = −1 );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
lProcess	Long	Process
QueryResults

ColumnName	ColumnType
spid	SQLOLE_DTypeInt2
locktype	SQLOLE_DTypeChar
tablename	SQLOLE_DTypeChar
page	SQLOLE_DTypeInt4
dbname	SQLOLE_DTypeChar
Reference

sp_lock


EnumProcesses List

SQLServer Object

Description

Lists the processes connected to SQL Server. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumProcesses ( [[WhoByNameOrID :=]
{idLogin | lProcess}] )

C++

HRESULT pSQLServer->EnumProcesses (
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR idLogin = NULL,
long lProcess = −1 );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
idLogin	Identifier	Login
lProcess	Long	Process
QueryResults

ColumnName	ColumnType
spid	SQLOLE_DTypeInt2
status	SQLOLE_DTypeChar
loginname	SQLOLE_DTypeChar
hostname	SQLOLE_DTypeChar
program_name	SQLOLE_DTypeChar
cmd	SQLOLE_DTypeChar
dbname	SQLOLE_DTypeChar
cpu	SQLOLE_DTypeInt4
memusage	SQLOLE_DTypeInt4
blocked	SQLOLE_DTypeInt2
Reference

sp_who


EnumPublicationDatabases List

SQLServer Object

Description

Lists publication databases. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumPublicationDatabases

C++

HRESULT pSQLServer->EnumPublicationDatabases ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar
Reference

sp_helpreplicationdb


EnumServerAttributes List

SQLServer Object

Description

Lists SQL Server attributes and current settings. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumServerAttributes

C++

HRESULT pSQLServer->EnumServerAttributes (
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
attribute_id	SQLOLE_DTypeInt4
attribute_name	SQLOLE_DTypeChar
attribute_value	SQLOLE_DTypeChar
Reference

sp_server_info


EnumSubscriberSubscriptions List

SQLServer Object

Description

Lists the subscription information for a subscriber SQL Server. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumSubscriberSubscriptions (
[Subscriber :=] idSubscriberServer,
[[SourceDatabase :=] idDatabase] )

C++

HRESULT pSQLServer->EnumSubscriberSubscriptions (
SQLOLE_LPCSTR idSubscriberServer,
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR idDatabase = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
idSubscriberServer	Identifier	Subscriber SQL Server
idDatabase	Identifier	Database
QueryResults

ColumnName	ColumnType
cSubscriber	SQLOLE_DTypeChar
cPubDBName	SQLOLE_DTypeChar
cPublication	SQLOLE_DTypeChar
cArticle	SQLOLE_DTypeChar


EnumSubscriptionDatabases List

SQLServer Object

Description

Lists subscription databases. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumSubscriptionDatabases

C++

HRESULT pSQLServer->EnumSubscriptionDatabases ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar
Reference

sp_helpreplicationdb


EnumVersionInfo List

SQLServer Object

Description

Lists version information. List is returned in a QueryResults object.

Visual Basic

QueryResults = SQLServer.EnumVersionInfo ( [[Prefixes :=] mstrPrefixes] )

C++

HRESULT pSQLServer->EnumVersionInfo (
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR mstrPrefixes = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
mstrPrefixes	MultiString	Delimited list of one or more prefix strings
QueryResults

ColumnName	ColumnType
Index	SQLOLE_DTypeInt2
Name	SQLOLE_DTypeChar
Internal_Value	SQLOLE_DTypeInt4
Character_Value	SQLOLE_DTypeChar
Reference

xp_msver


ListStartupProcedures List

SQLServer Object

Description

Lists the stored procedures that start automatically when SQL Server is started.

Visual Basic

StoredProcedureList = SQLServer.ListStartupProcedures

C++

HRESULT pSQLServer->ListStartupProcedures ( LPSQLOLESTOREDPROCEDURELIST* ppStoredProcedureList );

Elements

Element	Type	Description
StoredProcedureList	StoredProcedureList	Returned list of StoredProcedure objects
Reference

sp_helpstartup


SQLServer Collections

SQLServer Object     Properties     Methods     Lists     Collections

Collection	Description
Alerts Alerts Write: No	The collection of Alert objects.
Databases Databases Write: No	The collection of Database objects.
Devices Devices Write: No	The collection of Device objects.
Languages Languages Write: No	The collection of Language objects.
Logins Logins Write: No	The collection of Login objects.
Operators Operators Write: No	The collection of Operator objects.
Properties Properties Write: No	The collection of Property objects.
RemoteServers RemoteServers Write: No	The collection of RemoteServer objects.


SubscriberInfo Object

SubscriberInfo Object     Properties     Methods     Collections

Description

A SubscriberInfo object contains all the replication subscribing information about a RemoteServer.


SubscriberInfo Properties

SubscriberInfo Object     Properties     Methods     Collections

Property	Description
ActiveEndDate Date Write: Yes	The date and time before which this task is active.
ActiveStartDate Date Write: Yes	The date and time after which this task is active.
Application Application Write: No	The Application object.
CommitTransactionCount Long Write: Yes	The maximum number of transactions that will be sent to the remote server at a time.
FlushFrequency Long Write: Yes	The number of hours after distribution to wait before flushing.
FrequencyInterval Long Write: Yes	The the number of days between daily tasks, day of the week for weekly tasks, or the day of the month for monthly tasks, on which this task will occur.
FrequencyRecurrenceFactor Long Write: Yes	The number of weeks between weekly tasks, or the number of months between monthly tasks.
FrequencyRelativeInterval SQLOLE_FREQRELATIVE_TYPE  Write: Yes	The day of the month for monthly relative tasks, on which this task will occur.
FrequencySubDay SQLOLE_FREQSUB_TYPE  Write: Yes	Within a specifc day, the subday frequency unit of time, by minute or by hour.
FrequencySubDayInterval Long Write: Yes	The number of minutes between minutely tasks, or the number of hours between hourly tasks.
FrequencyType SQLOLE_FREQUENCY_TYPE Write: Yes	The primary frequency unit of time.
LogBatchSize Long Write: Yes	Reserved. Do not change this property.
Login Identifier Write: Yes	Reserved. Do not change this property.
Parent RemoteServer Write: No	The RemoteServer object.
Password Identifier Write: Yes	Reserved. Do not change this property.
Type Long Write: Yes	The type of subscription server. If 0, the remote server is running SQL Server 95. If 1, the remote server is running SQL Server version 4.2x.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


SubscriberInfo Methods

SubscriberInfo Object     Properties     Methods     Collections

BeginAlter

CancelAlter

DoAlter

Refresh


BeginAlter Method

SQLServer.RemoteServer.SubscriberInfo Object

Description

Marks the start of a single unit of changes to SubscriberInfo properties. Normally, each change to a single property is a separate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

SubscriberInfo.BeginAlter

C++

HRESULT pSubscriberInfo->BeginAlter ( );


CancelAlter Method

SQLServer.RemoteServer.SubscriberInfo Object

Description

Stops a unit of SubscriberInfo property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

SubscriberInfo.CancelAlter

C++

HRESULT pSubscriberInfo->CancelAlter ( );


DoAlter Method

SQLServer.RemoteServer.SubscriberInfo Object

Description

Commits a unit of SubscriberInfo property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

SubscriberInfo.DoAlter

C++

HRESULT pSubscriberInfo->DoAlter ( );


Refresh Method

SQLServer.RemoteServer.SubscriberInfo Object

Description

Updates SubscriberInfo properties with current values from SQL Server.

Visual Basic

SubscriberInfo.Refresh

C++

HRESULT pSubscriberInfo->Refresh ( );


SubscriberInfo Collections

SubscriberInfo Object     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Chapter 4   Database Scope Objects
Database Scope Objects

Article Object

Database Object

DBObject Object

DBOption Object

Default Object

Group Object

Publication Object

Rule Object

StoredProcedure Object

Subscription Object

SystemDatatype Object

TransactionLog Object

User Object

UserDefinedDatatype Object


Article Object

Article Object     Properties     Methods     Lists     Collections

Description

An Article contains information about an article contained in a publication.


Article Properties

Article Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
CreationScriptPath String Write: Yes	The full Universal Naming Convention (UNC) path and filename of the initial synchronization creation script for the article.
DeleteCommand String Write: Yes	The Transact-SQL statement to execute upon delete. If empty, construct the delete from the log.
Description String Write: Yes	A description for the article.
DestinationTableName Identifier Write: Yes	The name of the destination table on the subscribing server.
FilterClause String Write: Yes	The Transact-SQL WHERE clause used to filter the article for horizontal partitioning.
ID Long Write: No	The article ID.
InitialSyncObjectName Identifier Write: Yes	The table or view used to create the initial synchronization output file, if one was manually created. Values written to this property will be ignored when the article has no horizontal or vertical partitioning.
InsertCommand String Write: Yes	The Transact-SQL statement to execute upon insert. If empty, construct the insert from the log.
Name Identifier Write: Yes	The name of the article.
Parent Database Write: No	The Database object.
PreCreationMethod SQLOLE_PREARTICLE_TYPE  Write: Yes	The type of command executed on the destination table before synchronization occurs.
ReplicateAllColumns Boolean Write: No	Indicates if all columns of the source table are replicated. If True, all columns of the source table are replicated. If False, the source table has been vertically partitioned and only some columns are replicated.
ReplicationFilterProcName Identifier Write: Yes	The stored procedure that is used to filter the table for horizontal partitioning, if one was manually created. Values written to the property will be ignored if there is no horizontal or vertical filterin.
ReplicationType SQLOLE_REPLICATION_TYPE  Write: Yes	The type of replication to use for this article.
TableName Identifier Write: Before Add	The source table being published and replicated.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UpdateCommand String Write: Yes	The Transact-SQL statement to execute upon update. If empty, construct the update from the log.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQLDMO does not use this property.


Article Methods

Article Object     Properties     Methods     Lists     Collections

AddReplicatedColumns

BeginAlter

CancelAlter

DoAlter

Remove

RemoveReplicatedColumns

ScriptDestinationTable


AddReplicatedColumns Method

SQLServer.Database.Publication.Article Object

Description

Adds a list of columns of the source table to the group of columns that are replicated, if the Article is vertically partitioned.

Visual Basic

Article.AddReplicatedColumns ( [Columns :=] midColumns )

C++

HRESULT pArticle->AddReplicatedColumns ( SQLOLE_LPCSTR midColumns );

Elements

Element	Type	Description
midColumns	MultiString	Delimited list of columns. If empty, the vertical partition is cleared and all columns are included in the article.
Reference

sp_articlecolumn


BeginAlter Method

SQLServer.Database.Publication.Article Object

Description

Marks the start of a single unit of changes to Article properties. Normally, each change to a single property is a separate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

Article.BeginAlter

C++

HRESULT pArticle->BeginAlter ( );


CancelAlter Method

SQLServer.Database.Publication.Article Object

Description

Stops a unit of Article property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

Article.CancelAlter

C++

HRESULT pArticle->CancelAlter ( );


DoAlter Method

SQLServer.Database.Publication.Article Object

Description

Commits a unit of Article property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

Article.DoAlter

C++

HRESULT pArticle->DoAlter ( );


Remove Method

SQLServer.Database.Publication.Article Object

Description

Drops the SQL Server article and removes the Article object.

Visual Basic

Article.Remove

C++

HRESULT pArticle->Remove ( );

Reference

sp_droparticle


RemoveReplicatedColumns Method

SQLServer.Database.Publication.Article Object

Description

Removes a series of columns of the source table from the group of columns that are replicated.

Visual Basic

Article.RemoveReplicatedColumns ( [Columns :=] midColumns )

C++

HRESULT pArticle->RemoveReplicatedColumns ( SQLOLE_LPCSTR midColumns );

Elements

Element	Type	Description
midColumns	MultiIdentifier	Delimited list of columns
Reference

sp_articlecolumn


ScriptDestinationTable Method

SQLServer.Database.Publication.Article Object

Description

Produces a Transact-SQL script that can be used to create the subscribing (destination) table. This script includes the column subset if the Article is vertically partitioned.

Visual Basic

strSQLScript = Article.ScriptDestinationTable (
[ScriptType :=] tScriptOptions,
[[ScriptFilePath :=] strFile] )

C++

HRESULT pArticle->ScriptDestinationTable (
SQLOLE_SCRIPT_TYPE tScriptOptions = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrSQLScript = NULL );

Elements

Element	Type	Description
strSQLScript	String	Returned Transact-SQL script
tScriptOptions	SQLOLE_SCRIPT_TYPE	Script options
strFile	String	Full path and file name of Transact-SQL script file to create


Article Lists

Article Object     Properties     Methods     Lists     Collections

ListReplicatedColumns


ListReplicatedColumns List

SQLServer.Database.Publication.Article Object

Description

Returns a list of Column objects of the source table that are currently replicated.

Visual Basic

ColumnList = Article.ListReplicatedColumns

C++

HRESULT pArticle->ListReplicatedColumns ( LPSQLOLECOLUMNLIST* ppColumnList );

Elements

Element	Type	Description
ColumnList	ColumnList	Returned list of Column objects
Reference

sp_helparticlecolumns


Article Collections

Article Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.
Subscriptions Subscriptions Write: No	The collection of Subscription objects.


Database Object

Database Object     Properties     Methods     Lists     Collections

Description

A Database object contains other objects (like Table, View, and StoredProcedure objects) which contain or interact with data.


Database Properties

Database Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
CreateDate String Write: No	The date and time this database was created.
CreateForLoad Boolean Write: Before Add	Determines if this database was created with the FOR LOAD option.
DataSpaceUsage Float Write: No	The space in megabytes (accurate to two decimal places) used to store data.
DboLogin Boolean Write: No	Indicates if the login used for the connection (contained in the SQLServer object) has DBO privilege in this database.
DBOption DBOption Write: No	The DBOption object for this database.
IndexSpaceUsage Float Write: No	The space in megabytes (accurate to two decimal places) used to store indexes.
ID Long Write: No	The database ID.
MinimumSize Long Write: No	The minimum size this database can be shrunk to.
Name Identifier Write: Yes	The name of this database.
Owner Identifier Write: No	The login of the database owner.
Parent SQLServer Write: No	The SQLServer object.
Size Long Write: No	The total storage space in megabytes allocated for this database. This includes both used and available space.
SpaceAvailable Long Write: No	The unused storage space in kilobytes available for new data.
SpaceAvailableInMB Float Write: No	The unused storage space in megabytes (accurate to two decimal places) available for new data.
Status SQLOLE_DBSTATUS_TYPE  Write: No	The status of this database.
SystemObject Boolean Write: No	Indicates if this is a SQL Server system database. If True, this is a SQL Server system database. If False, this database was created by a user.
TransactionLog TransactionLog Write: No	The TransactionLog object for this database.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.
UserName Identifier Write: Yes	Name of the current database user. The SA or DBO can change this property to that of existing user in this database, thus impersonating that other user.
UserProfile SQLOLE_DBUSERPROFILE_TYPE  Write: No	The database profile information for the currently connected user.
Version Long Write: No	The version of the database from sysdatabases.


Database Methods

Database Object     Properties     Methods     Lists     Collections

CheckAllocations

CheckCatalog

Checkpoint

CheckTables

CheckTextAllocsFast

CheckTextAllocsFull

Dump

ExecuteImmediate

ExecuteWithResults

ExtendOnDevices

GenerateBackupSQL

GetDatatypeByName

GetMemoryUsage

GetObjectByName

Grant

IsValidKeyDatatype

Load

ManualSyncCompleted

ManualSyncPending

RecalcSpaceUsage

Remove

Revoke

SetOwner

Shrink

SpaceAllocatedOnDevice


CheckAllocations Method

SQLServer.Database Object

Description

Checks the internal allocation consistency of the database. This includes checking that data and index pages are consistent with the allocation information in the extent.

Visual Basic

strOutput = Database.CheckAllocations

C++

HRESULT pDatabase->CheckAllocations ( SQLOLE_LPBSTR pstrOutput );

Elements

Element	Type	Description
strOutput	String	The output returned by the internal consistency check
Reference

DBCC NEWALLOC


CheckCatalog Method

SQLServer.Database Object

Description

Checks the consistency of system tables and relationships between system tables for this database.

Visual Basic

strOutput = Database.CheckCatalog

C++

HRESULT pDatabase->CheckCatalog ( SQLOLE_LPBSTR pstrOutput );

Elements

Element	Type	Description
strOutput	String	The output returned by the internal consistency check
Reference

DBCC CHECKCATALOG


Checkpoint Method

SQLServer.Database Object

Description

Flushes the SQL Server cache, writing all changed pages to disk.

Visual Basic

Database.Checkpoint

C++

HRESULT pDatabase->Checkpoint ( );

Reference

CHECKPOINT


CheckTables Method

SQLServer.Database Object

Description

Checks the internal consistency of the data and index pages of every table in the database.

Visual Basic

strOutput = Database.CheckTables

C++

HRESULT pDatabase->CheckTables ( SQLOLE_LPBSTR pstrOutput );

Elements

Element	Type	Description
strOutput	String	The output returned by the internal consistency check
Reference

DBCC CHECKDB, DBCC CHECKTABLE


CheckTextAllocsFast Method

SQLServer.Database Object

Description

Checks the internal allocation consistency of text and image pages of every table in this database. This check is faster than the CheckTextAllocsFull method because it only checks data in existing text and image columns.

Visual Basic

strOutput = Database.CheckTextAllocsFast

C++

HRESULT pDatabase->CheckTextAllocsFast ( SQLOLE_LPBSTR pstrOutput );

Elements

Element	Type	Description
strOutput	String	The output returned by the internal consistency check
Reference

DBCC TEXTALL (..., FAST), DBCC TEXTALLOC (..., FAST)


CheckTextAllocsFull Method

SQLServer.Database Object

Description

Checks the internal allocation consistency of text and image pages of every table in this database. This check is slower and more thorough than CheckTextAllocsFast method because it checks the entire database for text and image data.

Visual Basic

strOutput = Database.CheckTextAllocsFull

C++

HRESULT pDatabase->CheckTextAllocsFull ( SQLOLE_LPBSTR pstrOutput );

Elements

Element	Type	Description
strOutput	String	The output returned by the internal consistency check
Reference

DBCC TEXTALL (..., FULL), DBCC TEXTALLOC (..., FULL)


Dump Method

SQLServer.Database Object

Description

Backs up a database to a dump device. Set the properties of a created Backup object as desired and pass it to the Dump method.

Visual Basic

Database.Dump ( [DumpSpec :=] Backup )

C++

HRESULT pDatabase->Dump ( LPSQLOLEBACKUP pBackup );

Elements

Element	Type	Description
Backup	Backup	Created Backup object that specifies how to execute database backup
Reference

DUMP DATABASE


ExecuteImmediate Method

SQLServer.Database Object

Description

Executes a Transact-SQL statement on a database. No results are returned to the application.

Visual Basic

Database.ExecuteImmediate (
[Command :=] strSQLStatement,
[[ExecType :=] tExecOption] )

C++

HRESULT pDatabase->ExecuteImmediate (
SQLOLE_LPCSTR strSQLStatement,
SQLOLE_EXEC_TYPE tExecOption = SQLOLEExec_Default );

Elements

Element	Type	Description
strSQLStatement	String	SQL statement
tExecOption	SQLOLE_EXEC_TYPE	Options for executing this SQL statement
Reference

EXECUTE


ExecuteWithResults Method

SQLServer.Database Object

Description

Executes a Transact-SQL statement on a database. Returns results in a QueryResults object.

Visual Basic

QueryResults = Database.ExecuteWithResults ( [Command :=] strSQLStatement )

C++

HRESULT pDatabase->ExecuteWithResults (
SQLOLE_LPCSTR strSQLStatement,
LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
strSQLStatement	String	SQL statement
QueryResults

The contents of the QueryResults object depend on the Transact-SQL statement.

Reference

EXECUTE


ExtendOnDevices Method

SQLServer.Database Object

Description

Increases the amount of storage space allocated to a database. The existing database storage space is extended to include available space on database devices.

Visual Basic

Database.ExtendOnDevices ( [DeviceNames :=] strDevices )

C++

HRESULT pDatabase->ExtendOnDevices ( SQLOLE_LPCSTR strDevices );

Elements

Element	Type	Description
strDevices	String	Comma delimited list of one or more database device usage specifiers. Each usage specifier consists of the database device name, an equal sign, and a size in megabytes.
Reference

ALTER DATABASE


GenerateBackupSQL Method

SQLServer.Database Object

Description

Generates a series of Transact-SQL statements (script) that can be used to backup this database. Set the properties of a created Backup object as desired and pass it to the GenerateBackupSQL method.

Visual Basic

strScript = Database.GenerateBackupSQL ( [DumpSpec :=] Backup )

C++

HRESULT pDatabase->GenerateBackupSQL (
LPSQLOLEBACKUP pBackup,
SQLOLE_LPBSTR pstrScript );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL backup script
Backup	Backup	Created Backup object that specifies how to execute the database backup
Remarks

To schedule this backup script, set the Task.Command property to the string returned by this method.


GetDatatypeByName Method

SQLServer.Database Object

Description

Returns a DBObject object that contains the specified system datatype or user-defined datatype object.

Visual Basic

DBObject = Database.GetDatatypeByName ( [TypeName :=] idDatatype )

C++

HRESULT pDatabase->GetDatatypeByName (
SQLOLE_LPCSTR idDatatype,
LPSQLOLESTDOBJECT* ppDBObject );

Elements

Element	Type	Description
DBObject	DBObject	Returned DBObject object
idDatatype	Identifier	Name of a system datatype or a user-defined datatype


GetMemoryUsage Method

SQLServer.Database Object

Description

Returns detailed reports on SQL Server memory usage.

Visual Basic

strOutput = Database.GetMemoryUsage

C++

HRESULT pDatabase->GetMemoryUsage ( SQLOLE_LPBSTR pstrOutput );

Elements

Element	Type	Description
strOutput	String	The output returned by the internal consistency check
Reference

DBCC MEMUSAGE


GetObjectByName Method

SQLServer.Database Object

Description

Returns a DBObject object that contains the specified SQL Server object.

Visual Basic

DBObject = Database.GetObjectByName (
[ObjectName :=] idSQLObject,
[[ObjectType :=] tObjectType] )

C++

HRESULT pDatabase->GetObjectByName (
SQLOLE_LPCSTR idSQLObject,
LPSQLOLEDBOBJECT* ppDBObject,
SQLOLE_OBJECT_TYPE tObjectType =
SQLOLEObj_AllDatabaseObjects );

Elements

Element	Type	Description
DBObject	DBObject	Returned DBObject object
idSQLObject	Identifier	Name of SQL Server object to return
tObjectType	SQLOLE_OBJECT_TYPE	Type of object. If you do not know the object type, SQL-DMO must query the server to determine it. If you pass it in, this overhead is not required.


Grant Method

SQLServer.Database Object

Description

Gives statement permissions to a list of SQL Server users and groups.

Visual Basic

Database.Grant (
[Privileges :=] tPrivileges,
[GranteeNames :=] midUserGroupList )

C++

HRESULT pDatabase->Grant (
SQLOLE_PRIVILEGE_TYPE tPrivileges,
SQLOLE_LPCSTR midUserGroupList );

Elements

Element	Type	Description
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of statement privileges to grant
midUserGroupList	MultiIdentifier	Delimited list of one or more users and groups
Reference

GRANT


IsValidKeyDatatype Method

SQLServer.Database Object

Description

Indicates if the proposed key datatype is valid for use as a key column, and if it is compatible with the proposed reference datatype.

Visual Basic

bValid = Database.IsValidKeyDatatype (
[KeyColType :=] idKeyDatatype,
[[ReferencingColType :=] idReferenceDatatype] )

C++

HRESULT pDatabase->IsValidKeyDatatype (
SQLOLE_LPCSTR idKeyDatatype,
LPBOOL pbValid,
SQLOLE_LPCSTR idReferenceDatatype = NULL );

Elements

Element	Type	Description
bValid	Boolean	Returned value indicates if the key datatype is valid and compatible with the reference datatype. If True, the key datatype is valid and compatible with the reference datatype. If False, the key datatype is either not valid or not compatible with the reference datatype.
idKeyDatatype	Identifier	Name of the key datatype
idReferenceDatatype	Identifier	Name of the reference datatype


Load Method

SQLServer.Database Object

Description

Restores a database using an existing backup from a dump device. Set the properties of a created Backup object as desired and pass it to the Load method.

Visual Basic

Database.Load ( [LoadSpec :=] Backup )

C++

HRESULT pDatabase->Load ( LPSQLOLEBACKUP pBackup );

Elements

Element	Type	Description
Backup	Backup	Created Backup object that specifies how to execute database backup
Reference

LOAD DATABASE


ManualSyncCompleted Method

SQLServer.Database Object

Description

Marks a manual synchronization as having been completed by the user.

Visual Basic

Database.ManualSyncCompleted (
[PubServerName :=] idServer,
[PubDatabaseName :=] idDatabase,
[PublicationName :=] idPublication,
[[ArticleName :=] idArticle] )

C++

HRESULT pDatabase->ManualSyncCompleted (
SQLOLE_LPCSTR idServer,
SQLOLE_LPCSTR idDatabase,
SQLOLE_LPCSTR idPublication,
SQLOLE_LPCSTR idArticle = NULL );

Elements

Element	Type	Description
idServer	Identifier	Publishing server
idDatabase	Identifier	Database
idPublication	Identifier	Publication
idArticle	Identifier	Article
Reference

repl_syncdone


ManualSyncPending Method

SQLServer.Database Object

Description

Indicates if manual synchronization has been specified but not yet completed. Call ManualSyncCompleted when you have completed the manual synchronization.

Visual Basic

bSyncPending = Database.ManualSyncPending (
[PubServerName :=] idServer,
[PubDatabaseName :=] idDatabase,
[PublicationName :=] idPublication,
[ArticleName :=] idArticle )

C++

HRESULT pDatabase->ManualSyncPending (
SQLOLE_LPCSTR idServer,
SQLOLE_LPCSTR idDatabase,
SQLOLE_LPCSTR idPublication,
SQLOLE_LPCSTR idArticle,
LPBOOL pbSyncPending );

Elements

Element	Type	Description
bSyncPending	Boolean	Indicates if manual synchronization is pending. If True, manual synchronization has not been completed. If False, the user has indicated that manual synchronization has been completed by the user.
idServer	Identifier	Publishing server
idDatabase	Identifier	Database
idPublication	Identifier	Publication
idArticle	Identifier	Article
Remarks

This is an indexed property.


RecalcSpaceUsage Method

SQLServer.Database Object

Description

Recalculates the latest space usage information for the database.

Visual Basic

Database.RecalcSpaceUsage

C++

HRESULT pDatabase->RecalcSpaceUsage ( );


Remove Method

SQLServer.Database Object

Description

Drops the SQL Server database and removes the Database object.

Visual Basic

Database.Remove

C++

HRESULT pDatabase->Remove ( );

Reference

DROP DATABASE


Revoke Method

SQLServer.Database Object

Description

Removes statement permissions from a list of SQL Server users and groups.

Visual Basic

Database.Revoke (
[Privileges :=] tPrivileges,
[RevokeeNames :=] midUserGroupList )

C++

HRESULT pDatabase->Revoke (
SQLOLE_PRIVILEGE_TYPE tPrivileges,
SQLOLE_LPCSTR midUserGroupList );

Elements

Element	Type	Description
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of statement privileges to revoke
midUserGroupList	MultiIdentifier	Delimited list of one or more users and groups
Reference

REVOKE


SetOwner Method

SQLServer.Database Object

Description

Changes the owner of a database (DBO) to a new login.

Visual Basic

Database.SetOwner (
[LoginName :=] idLogin,
[[TransferAliases :=] bTransfer,]
[[OverrideIfAlreadyUser :=] bOverride] )

C++

HRESULT pDatabase->SetOwner (
SQLOLE_LPCSTR idLogin,
BOOL bTransfer = FALSE,
BOOL bOverride = FALSE );

Elements

Element	Type	Description
idLogin	Identifier	Login of the new database owner
bTransfer	Boolean	Determines if existing aliases and permissions are transferred to the new database owner. The default is False.
bOverride	Boolean	Determines if the database ownership should still be changed if the new login is already a user in this database. If True, the specified login will become the new database owner. If False, the specified login will become the new database owner only if that login is not a user in this database. The default is False.
Remarks

This is an indexed property.

Reference

sp_changedbowner


Shrink Method

SQLServer.Database Object

Description

Reduces the space allocated to a database

Visual Basic

Database.Shrink ( [NewSizeInMB :=] lNewSizeInMB )

C++

HRESULT pDatabase->Shrink ( long lNewSizeInMB );

Elements

Element	Type	Description
lNewSizeInMB	Long	New size of the database in megabytes
Reference

DBCC SHRINKDB


SpaceAllocatedOnDevice Method

SQLServer.Database Object

Description

Returns the total amount of storage space this database has allocated on the specified device.

Visual Basic

lAllocated = Database.SpaceAllocatedOnDevice ( [DeviceName :=] idDevice )

C++

HRESULT pDatabase->GetSpaceAllocatedOnDevice (
SQLOLE_LPCSTR idDevice,
LPLONG plAllocated );

Elements

Element	Type	Description
lAllocated	Long	Total allocated storage space in megabytes
idDevice	Identifier	Device name
Remarks

This is an indexed property.


Database Lists

Database Object     Properties     Methods     Lists     Collections

EnumCandidateKeys

EnumDependencies

EnumLocks

ListDatabasePermissions

ListDevices

ListObjectPermissions

ListObjects


EnumCandidateKeys List

SQLServer.Database Object

Description

Lists all available primary keys in the database. List is returned in a QueryResults object.

Visual Basic

QueryResults = Database.EnumCandidateKeys

C++

HRESULT pDatabase->EnumCandidateKeys ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
candidate_table	SQLOLE_DTypeChar
candidate_key	SQLOLE_DTypeChar


EnumDependencies List

SQLServer.Database Object

Description

Lists all user-created objects in the database in dependency order. These objects must be created in this order. List is returned in a QueryResults object.

Visual Basic

QueryResults = Database.EnumDependencies ( [[DependencyType :=] tDependency] )

C++

HRESULT pDatabase->EnumDependencies (
LPSQLOLEQUERYRESULTS* ppQueryResults, SQLOLE_DEPENDENCY_TYPE tDependency = SQLOLEDep_Parents );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
tDependency	SQLOLE_DEPENDENCY_TYPE	Dependency type
QueryResults

This method can return up to three results sets.

ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oRuleDefName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oUDDTName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oObjName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2


EnumLocks List

SQLServer.Database Object

Description

Lists the locks held by a SQL Server process. List is returned in a QueryResults object.

Visual Basic

QueryResults = Database.EnumLocks ( [[Who :=] lProcess] )

C++

HRESULT pDatabase->EnumLocks (
LPSQLOLEQUERYRESULTS* ppQueryResults,
long lProcess = -1 );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
lProcess	Long	SQL Server process
QueryResults

ColumnName	ColumnType
spid	SQLOLE_DTypeInt2
locktype	SQLOLE_DTypeChar
tablename	SQLOLE_DTypeChar
page	SQLOLE_DTypeInt4
dbname	SQLOLE_DTypeChar


ListDatabasePermissions List

SQLServer.Database Object

Description

Returns a list of Permission objects containing the statement privileges for this database.

Visual Basic

PermissionList = Database.ListDatabasePermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pDatabase->ListDatabasePermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList,
SQLOLE_PRIVILEGE_TYPE tPrivileges =
SQLOLEPriv_AllDatabasePrivs );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of statement privileges to list


ListDevices List

SQLServer.Database Object

Description

Returns a list of Device objects used by this database.

Visual Basic

DeviceList = Database.ListDevices

C++

HRESULT pDatabase->ListDevices ( LPSQLOLEDEVICELIST* ppDeviceList );

Elements

Element	Type	Description
DeviceList	DeviceList	Returned list of Device objects


ListObjectPermissions List

SQLServer.Database Object

Description

Returns a list of Permission objects containing the object privileges for this database.

Visual Basic

PermissionList = Database.ListObjectPermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pDatabase->ListObjectPermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList ,
SQLOLE_PRIVILEGE_TYPE tPrivileges = SQLOLEPriv_AllObjectPrivs );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of object privileges to list


ListObjects List

SQLServer.Database Object

Description

Returns a list of DBObject objects containing the database objects stored in the database.

Visual Basic

DBObjectList = Database.ListObjects (
[[ObjectTypes :=] tObjects,]
[[SortBy :=] tSortBy] )

C++

HRESULT pDatabase->ListObjects (
LPSQLOLEDBOBJECTLIST* ppDBObjectList,
SQLOLE_OBJECT_TYPE tObjects = SQLOLEObj_AllDatabaseObjects,
SQLOLE_OBJSORT_TYPE tSortBy = SQLOLEObjSort_Name );

Elements

Element	Type	Description
DBObjectList	DBObjectList	Returned list of DBObject objects
tObjects	SQLOLE_OBJECT_TYPE	Types of database objects to list
tSortBy	SortType	How the list is sorted


Database Collections

Database Object     Properties     Methods     Lists     Collections

Collection	Description
Defaults Defaults Write: No	The collection of Default objects.
Groups Groups Write: No	The collection of Group objects.
Properties Properties Write: No	The collection of Property objects.
Publications Publications Write: No	The collection of Publication objects.
Rules Rules Write: No	The collection of Rule objects.
StoredProcedures StoredProcedures Write: No	The collection of StoredProcedure objects.
SystemDatatypes SystemDatatypes Write: No	The collection of SystemDatatype objects.
Tables Tables Write: No	The collection of Table objects.
UserDefinedDatatypes UserDefinedDatatypes Write: No	The collection of UserDefinedDatatype objects.
Users Users Write: No	The collection of User objects.
Views Views Write: No	The collection of View objects.


DBObject Object

DBObject Object     Properties     Methods     Lists     Collections

Description

The DBObject object is a generic object that contains information appropriate for all types of database objects. A DBObject is closely tied to a specific SQL-DMO object, but presents a generic interface that allows the same code to apply to multiple object types.

A DBObject can represent a Table, View, Rule, Default, StoredProcedure, Trigger, or UserDefinedDatatype object.


DBObject Properties

DBObject Object     Properties     Methods     Lists     Collections

Property	Description
CreateDate String Write: No	The date and time the object was created.
ID Long Write: No	The object ID.
Name Identifier Write: Yes	The name of the object.
Owner Identifier Write: No	The user that created the object.
Parent Database Write: No	The Database object.
SystemObject Boolean Write: No	Indicates if this is a SQL Server system object. If True, this is a SQL Server system object. If False, this object was created by a user.
Type SQLOLE_OBJECT_TYPE  Write: No	The type of object.
TypeName String Write: No	Description of the type of the object.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


DBObject Methods

DBObject Object     Properties     Methods     Lists     Collections

Remove

Script


Remove Method

SQLServer.Database.DBObject Object

Description

Drops the underlying SQL Server object and removes the SQL-DMO object from its parent collection.

Visual Basic

DBObject.Remove

C++

HRESULT pDBObject->Remove ( );


Script Method

SQLServer.Database.DBObject Object

Description

Generates a series of Transact-SQL statements (script) to create the underlying object.

Visual Basic

strScript = DBObject.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pDBObject->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


DBObject Lists

DBObject Object     Properties     Methods     Lists     Collections

EnumDependencies

ListPermissions

ListUserPermissions


EnumDependencies List

SQLServer.Database.DBObject Object

Description

Lists the database objects that depend on this DBObject, or database objects that this DBObject depends on, in dependency order. List is returned in a QueryResults object.

Visual Basic

QueryResults = DBObject.EnumDependencies ( [[DependencyType :=] tDependency] )

C++

HRESULT pDBObject->EnumDependencies (
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_DEPENDENCY_TYPE tDependency = SQLOLEDep_Parents );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
tDependency	SQLOLE_DEPENDENCY_TYPE	Type of dependencies to return
QueryResults

This method can return up to three results sets.

ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oRuleDefName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oUDDTName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oObjName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2


ListPermissions List

SQLServer.Database.DBObject Object

Description

Returns a list of Permission objects containing the object privileges for this object.

Visual Basic

PermissionList = DBObject.ListPermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pDBObject->ListPermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList ,
SQLOLE_PRIVILEGE_TYPE tPrivileges = SQLOLEPriv_AllObjectPrivs );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of object privileges to list
Reference

sp_helpprotect


ListUserPermissions List

SQLServer.Database.DBObject Object

Description

Returns a list of Permission objects containing the specified user's privileges for this object.

Visual Basic

PermissionList = DBObject.ListUserPermissions ( [UserName :=] idUser )

C++

HRESULT pDBObject->ListUserPermissions (
SQLOLE_LPCSTR idUser,
LPSQLOLEPERMISSIONLIST* ppPermissionList );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
idUser	Identifier	User
Reference

sp_helpprotect


DBObject Collections

DBObject Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


DBOption Object

DBOption Object     Properties     Methods     Collections

Description

A DBOption object contains all the database options for a database. These options can be set by the database owner. The DBOption object is a property of the Database object.


DBOption Properties

DBOption Object     Properties     Methods     Collections

Property	Description
ColumnsNullByDefault Boolean Write: Yes	Determines if columns in newly created tables allow nulls by default. If True, columns will allow null values unless they are explicitly defined as not allowing null values (NOT NULL). If False, columns will not allow null values unless they are explicitly defined as allowing null values.
DBOUseOnly Boolean Write: Yes	Determines if only the database owner can use the database. If True, only the database owner can use the database. If False, every user can use the database.
EnablePublishing Boolean Write: Yes	Determines if articles can be published for replication in this database. If True, articles can be published and replication from this database is enabled. If False, this database cannot publish articles for replication.
EnableSubscribing Boolean Write: Yes	Determines if published articles can be subscribed to by this database. If True, articles can be subscribed to and replication to this database is enabled. If False, this database cannot subscribe to articles for replication.
NoCheckpointOnRecovery Boolean Write: Yes	Determines if an up-to-date copy of a database is kept. If True, an up-to-date copy of the database is kept. If False, a checkpoint record is added to a database after it is recovered due to restarting SQL Server.
Offline Boolean Write: Yes	Determines if the database if offline and unavailable for use. If True, the database is unavailable. If False, the database is online and available for use as normal.
Parent Database Write: No	The Database object.
ReadOnly Boolean Write: Yes	Determines if all changes to the database are disabled. If True, the database is read only and cannot be changed. If False, the data can be changed as normal.
SelectIntoBulkCopy Boolean Write: Yes	Determines if the following unlogged operations are allowed in the database: WRITETEXT, SELECT INTO into a permanent table, and fast bulk copy into a table with no indexes. If True, unlogged operations are allowed and you can use the above statements. If False, unlogged operations are not allowed.
SingleUser Boolean Write: Yes	Determines if only one user at a time can use the database. If True, the database is in single user mode. If False, multiple users can access the database as normal.
TruncateLogOnCheckpoint Boolean Write: Yes	Determines if the transaction log is truncated (committed transactions are removed) every time the automatic CHECKPOINT checking process occurs. If True, the transaction log is truncated automatically on CHECKPOINT. If False, the transaction log is not truncated automatically.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


DBOption Methods

DBOption Object     Properties     Methods     Collections

Refresh


Refresh Method

SQLServer.Database.DBOption Object

Description

Updates DBOption properties with current database options from SQL Server.

Visual Basic

DBOption.Refresh

C++

HRESULT pDBOption->Refresh ( );


DBOption Collections

DBOption Object     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Default Object

Default Object     Properties     Methods     Lists     Collections

Description

A Default object is a value which is stored in a column or datatype if no other value is supplied.


Default Object Properties
Default Properties

Default Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
CreateDate String Write: No	The date and time the default was created.
ID Long Write: No	The object ID of the default.
Name Identifier Write: Yes	The name of the default.
Owner Identifier Write: No	The user who created the default.
Parent Database Write: No	The Database object.
Text String Write: Before Add	The Transact-SQL statement used to create the default.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Default Object Methods
Default Methods

Default Object     Properties     Methods     Lists     Collections

BindToColumn

BindToDatatype

Remove

Script

UnbindFromColumn

UnbindFromDatatype


BindToColumn Property
BindToColumn Method

SQLServer.Database.Default Object

Description

Binds a default to a column of an existing table.

Visual Basic

Default.BindToColumn (
[TableName :=] idTable,
[ColumnName :=] idColumn )

C++

HRESULT pDefault->BindToColumn (
SQLOLE_LPCSTR idTable,
SQLOLE_LPCSTR idColumn );

Elements

Element	Type	Description
idTable	Identifier	Table
idColumn	Identifier	Column
Reference

sp_bindefault


BindToDatatype Method

SQLServer.Database.Default Object

Description

Binds a default with an existing user-defined datatype.

Visual Basic

Default.BindToDatatype (
[DatatypeName :=] idDatatype,
[[FutureOnly :=] bFutureOnly] )

C++

HRESULT pDefault->BindToDatatype (
SQLOLE_LPCSTR idDatatype,
BOOL bFutureOnly = FALSE );

Elements

Element	Type	Description
idDatatype	Identifier	User-defined datatype
bFutureOnly	Boolean	Determines if existing columns of the specified datatype are prevented from inheriting the new default. If True, existing columns are not bound to the new default. If False, existing columns are bound to the new default. The default is False.
Reference

sp_bindefault


Remove Method

SQLServer.Database.Default Object

Description

Drops the SQL Server default and removes the Default object.

Visual Basic

Default.Remove ( )

C++

HRESULT pDefault->Remove ( );

Reference

DROP DEFAULT


Script Method

SQLServer.Database.Default Object

Description

Generates a series of Transact-SQL statements (script) to create the default.

Visual Basic

strScript = Default.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pDefault->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


UnbindFromColumn Method

SQLServer.Database.Default Object

Description

Breaks an existing binding between a default and a column of a table.

Visual Basic

Default.UnbindFromColumn (
[TableName :=] idTable,
[ColumnName :=] idColumn )

C++

HRESULT pDefault->UnbindFromColumn (
SQLOLE_LPCSTR idTable,
SQLOLE_LPCSTR idColumn );

Elements

Element	Type	Description
idTable	Identifier	Table
idColumn	Identifier	Column
Reference

sp_unbindefault


UnbindFromDatatype Method

SQLServer.Database.Default Object

Description

Breaks an existing binding between a default and a user-defined datatype.

Visual Basic

Default.UnbindFromDatatype (
[DatatypeName :=] idDatatype,
[[FutureOnly :=] bFutureOnly] )

C++

HRESULT pDefault->UnbindFromDatatype (
SQLOLE_LPCSTR idDatatype,
BOOL bFutureOnly = FALSE );

Elements

Element	Type	Description
idDatatype	Identifer	User-defined datatype
bFutureOnly	Boolean	Determines if existing columns of the specified datatype are prevented from losing the old default. If True, existing columns keep the old default. If False, existing columns lose the old default. The default is False.
Reference

sp_unbindefault


Default Lists

Default Object     Properties     Methods     Lists     Collections

ListBoundColumns

ListBoundDatatypes


ListBoundColumns List

SQLServer.Database.Default Object

Description

Returns a list of Column objects that are currently bound to this Default.

Visual Basic

ColumnList = Default.ListBoundColumns

C++

HRESULT pDefault->ListBoundColumns ( LPSQLOLECOLUMNLIST* ppColumnList );

Elements

Element	Type	Description
ColumnList	ColumnList	Returned list of Column objects
Reference

sp_helpconstraint


ListBoundDatatypes List

SQLServer.Database.Default Object

Description

Returns a list of UserDefinedDatatype objects that are currently bound to this Default.

Visual Basic

UserDefinedDatatypeList = Default.ListBoundDatatypes

C++

HRESULT pDefault->ListBoundDatatypes ( LPSQLOLEUSERDEFINEDDATATYPELIST*
ppUserDefinedDatatypeList );

Elements

Element	Type	Description
UserDefinedDatatypeList	UserDefinedDatatypeList	Returned list of UserDefinedDatatype objects


Default Collections

Default Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Group Object

Group Object     Properties     Methods     Lists     Collections

Description

A Group object contains information about a collection of users.


Group Properties

Group Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
ID Long Write: No	The group ID.
Name Identifier Write: Before Add	The name of the group.
Parent Database Write: No	The Database object.
SystemObject Boolean Write: No	Indicates if this is a SQL Server system group. If True, this is the public group. If False, this is not the public group.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Group Methods

Group Object     Properties     Methods     Lists     Collections

Remove

Script


Remove Method

SQLServer.Database.Group Object

Description

Drops the SQL Server group and removes the Group object.

Visual Basic

Group.Remove

C++

HRESULT pGroup->Remove ( );

Remarks

You cannot remove the public group.

Reference

sp_dropgroup


Script Method

SQLServer.Database.Group Object

Description

Generates a series of Transact-SQL statements (script) to create the group.

Visual Basic

strScript = Group.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pGroup->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


Group Lists

Group Object     Properties     Methods     Lists     Collections

ListDatabasePermissions

ListObjectPermissions

ListUsers


ListDatabasePermissions List

SQLServer.Database.Group Object

Description

Returns a list of Permission objects containing the statement privileges for this group.

Visual Basic

PermissionList = Group.ListDatabasePermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pGroup->ListDatabasePermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList ,
SQLOLE_PRIVILEGE_TYPE tPrivileges =
SQLOLEPriv_AllDatabasePrivs );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of statement privileges to list


ListObjectPermissions List

SQLServer.Database.Group Object

Description

Returns a list of Permission objects containing the object privileges for this group.

Visual Basic

PermissionList = Group.ListObjectPermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pGroup->ListObjectPermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList,
SQLOLE_PRIVILEGE_TYPE tPrivileges = SQLOLEPriv_AllObjectPrivs );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of object privileges to list


ListUsers List

SQLServer.Database.Group Object

Description

Returns a list of User objects that are members of this group.

Visual Basic

UserList = Group.ListUsers

C++

HRESULT pGroup->ListUsers ( LPSQLOLEUSERLIST* ppUserList );

Elements

Element	Type	Description
UserList	UserList	Returned list of User objects


Group Collections

Group Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Publication Object

Publication Object     Properties     Methods     Lists     Collections

Description

A Publication object contains information about a publication (containing articles) used for replication.


Publication Properties

Publication Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
Description String Write: Yes	A description for the publication.
Enabled Boolean Write: Yes	Determines if the publication can be replicated. If True, the publication is enabled for replication. If False, the publication is not enabled for replication and cannot be replicated.
ID Long Write: No	The publication ID.
InitialSyncMethod SQLOLE_INITIALSYNC_TYPE  Write: Yes	The initial synchronization method provided by the publication server for this publication and used to synchronize the subscription server prior to beginning scheduled replication.
InitialSyncTask Task Write: No	The Task object used for initial synchronization.
Name Identifier Write: Yes	The name of the publication.
Parent Database Write: No	The Database object.
ReplicationFrequency SQLOLE_REPFREQ_TYPE  Write: Yes	The replication frequency of the publication.
Restricted Boolean Write: Yes	Determines whether the publication is restricted to authorized subscription servers. If True, only authorized subscription servers can subscribe to this publication. If False, any server can subscribe to this publication.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQLDMO does not use this property.


Publication Methods

Publication Object     Properties     Methods     Lists     Collections

BeginAlter

CancelAlter

DoAlter

Remove


BeginAlter Method

SQLServer.Database.Publication Object

Description

Marks the start of a single unit of changes to Publication properties. Normally, each change to a single property is a separate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

Publication.BeginAlter

C++

HRESULT pPublication->BeginAlter ( );


CancelAlter Method

SQLServer.Database.Publication Object

Description

Stops a unit of Publication property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

Publication.CancelAlter

C++

HRESULT pPublication->CancelAlter ( );


DoAlter Method

SQLServer.Database.Publication Object

Description

Commits a unit of Publication property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

Publication.DoAlter

C++

HRESULT pPublication->DoAlter ( );


Remove Method

SQLServer.Database.Publication Object

Description

Drops the SQL Server publication and removes the Publication object.

Visual Basic

Publication.Remove

C++

HRESULT pPublication->Remove ( );

Reference

sp_droppublication


Publication Lists

Publication Object     Properties     Methods     Lists     Collections

EnumFullSubscribers


EnumFullSubscribers List

SQLServer.Database.Publication Object

Description

Lists the servers that subscribe to all articles in this publication. List is returned in a QueryResults object.

Visual Basic

QueryResults = Publication.EnumFullSubscribers

C++

HRESULT pPublication->EnumFullSubscribers ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
subscriber	SQLOLE_DTypeChar


Publication Collections

Publication Object     Properties     Methods     Lists     Collections

Property	Description
Articles Articles Write:	The collection of Article objects.
Properties Properties Write: No	The collection of Property objects.


Rule Object

Rule Object     Properties      Methods     Lists     Collections

Description

A Rule object contains information that defines a domain of valid values that can be stored in a column or datatype.


Rule Object Properties
Rule Properties

Rule Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
CreateDate String Write: No	The date and time this rule was created.
ID Long Write: No	The object ID of the rule.
Name Identifier Write: Yes	The name of the rule.
Owner Identifier Write: No	The user ID of the user who created the rule.
Parent Database Write: No	The Database object.
Text String Write: Before Add	The Transact-SQL statement used to create the rule.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Rule Object Methods
Rule Methods

Rule Object     Properties     Methods     Lists     Collections

BindToColumn

BindToDatatype

Remove

Script

UnbindFromColumn

UnbindFromDatatype


BindToColumn Method

SQLServer.Database.Rule Object

Description

Binds a rule to a column of an existing table.

Visual Basic

Rule.BindToColumn (
[TableName :=] idTable,
[ColumnName :=] idColumn )

C++

HRESULT pRule->BindToColumn (
SQLOLE_LPCSTR idTable,
SQLOLE_LPCSTR idColumn );

Elements

Element	Type	Description
idTable	Identifier	Table
idColumn	Identifier	Column
Reference

sp_bindrule


BindToDatatype Method

SQLServer.Database.Rule Object

Description

Binds a rule with an existing user-defined datatype.

Visual Basic

Rule.BindToDatatype (
[DatatypeName :=] idDatatype,
[[FutureOnly :=] bFutureOnly] )

C++

HRESULT pRule->BindToDatatype (
SQLOLE_LPCSTR idDatatype,
BOOL bFutureOnly = FALSE );

Elements

Element	Type	Description
idDatatype	Identifer	User-defined datatype
bFutureOnly	Boolean	Determines if existing columns of the specified datatype are prevented from inheriting the new rule. If True, existing columns are not bound to the new rule. If False, existing columns are bound to the new rule. The default is False.
Reference

sp_bindrule


Remove Method

SQLServer.Database.Rule Object

Description

Drops the SQL Server rule and removes the Rule object.

Visual Basic

Rule.Remove ( );

C++

HRESULT pRule->Remove ( );

Reference

DROP RULE


Script Method

SQLServer.Database.Rule Object

Description

Generates a series of Transact-SQL statements (script) to create the default.

Visual Basic

strScript = Rule.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pRule->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


UnbindFromColumn Method

SQLServer.Database.Rule Object

Description

Breaks an existing binding between a rule and a column of a table.

Visual Basic

Rule.UnbindFromColumn (
[TableName :=] idTable,
[ColumnName :=] idColumn )

C++

HRESULT pRule->UnbindFromColumn (
SQLOLE_LPCSTR idTable,
SQLOLE_LPCSTR idColumn );

Elements

Element	Type	Description
idTable	Identifier	Table
idColumn	Identifier	Column
Reference

sp_unbindrule


UnbindFromDatatype Method

SQLServer.Database.Rule Object

Description

Breaks an existing binding between a rule and a user-defined datatype.

Visual Basic

Rule.UnbindFromDatatype (
[DatatypeName :=] idDatatype,
[[FutureOnly :=] bFutureOnly] )

C++

HRESULT pRule->UnbindFromDatatype (
SQLOLE_LPCSTR idDatatype,
BOOL bFutureOnly = FALSE );

Elements

Element	Type	Description
idDatatype	Identifer	User-defined datatype
bFutureOnly	Boolean	Determines if existing columns of the specified datatype are prevented from losing the old rule. If True, existing columns keep the old rule. If False, existing columns lose the old rule. The default is False.
Reference

sp_unbindrule


Rule Lists

Rule Object     Properties     Methods     Lists     Collections

ListBoundColumns

ListBoundDatatypes


ListBoundColumns List

SQLServer.Database.Rule Object

Description

Returns a list of Column objects that are currently bound to this Rule.

Visual Basic

ColumnList = Rule.ListBoundColumns

C++

HRESULT pRule->ListBoundColumns ( LPSQLOLECOLUMNLIST* ppColumnList );

Elements

Element	Type	Description
ColumnList	ColumnList	Returned list of Column objects
Reference

sp_helpconstraint


ListBoundDatatypes List

SQLServer.Database.Rule Object

Description

Returns a list of UserDefinedDatatype objects that are currently bound to this Rule.

Visual Basic

UserDefinedDatatypeList = Rule.ListBoundDatatypes

C++

HRESULT pRule->ListBoundDatatypes ( LPSQLOLEUSERDEFINEDDATATYPELIST*
ppUserDefinedDatatypeList );

Elements

Element	Type	Description
UserDefinedDatatypeList	UserDefinedDatatypeList	Returned list of UserDefinedDatatype objects


Rule Collections

Rule Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


StoredProcedure Object

StoredProcedure Object     Properties     Methods     Lists     Collections

Description

A StoredProcedure object is a named set of Transact-SQL statements that are stored within a database. A standard stored procedure is a Transact-SQL procedure stored within the database. An extended stored procedure is an external DLL function.


StoredProcedure Object Properties
StoredProcedure Properties

StoredProcedure Object     Properties     Method     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
CreateDate String Write: No	The date and time the stored procedure was created.
ID Long Write: No	The object ID of the stored procedure.
Name Identifier Write: Yes	The name of the stored procedure.
Owner Identifier Write: No	The user who created the stored procedure.
Parent Database Write: No	The Database object.
Startup Boolean Write: Before Add	Determines if this stored procedure is executed automatically when SQL Server starts. If True, this stored procedure is executed automatically when SQL Server starts. If False, it is not executed automatically.
SystemObject Boolean Write: No	Indicates if this is a SQL Server system stored procedure. If True, this is a SQL Server system stored procedure. If False, this stored procedure was created by a user.
Text String Write: Before Add	The original Transact-SQL statement used to create the standard stored procedure, or the full path and file name of the extended stored procedure DLL.
Type SQLOLE_PROCEDURE_TYPE  Write: No	The type of stored procedure.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQLDMO does not use this property.


StoredProcedure Object Methods
StoredProcedure Methods

StoredProcedure Object     Properties     Method     Lists     Collections

Grant

Remove

Revoke

Script


Grant Method

SQLServer.Database.StoredProcedure Object

Description

Gives stored procedure privileges to a list of SQL Server users and groups.

Visual Basic

StoredProcedure.Grant (
[Privileges :=] tPrivileges,
[GranteeNames :=] midUserGroupList )

C++

HRESULT pStoredProcedure->Grant (
SQLOLE_PRIVILEGE_TYPE tPrivileges,
SQLOLE_LPCSTR midUserGroupList );

Elements

Element	Type	Description
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of stored procedure privileges to grant
midUserGroupList	MultiIdentifier	Delimited list of one or more users and groups
Reference

GRANT


Remove Method

SQLServer.Database.StoredProcedure Object

Description

Drops the SQL Server stored procedure and removes the StoredProcedure object.

Visual Basic

StoredProcedure.Remove

C++

HRESULT pStoredProcedure->Remove ( );

Reference

DROP PROCEDURE


Revoke Method

SQLServer.Database.StoredProcedure Object

Description

Removes stored procedure privileges from a list of SQL Server users and groups.

Visual Basic

StoredProcedure.Revoke (
[Privileges :=] tPrivileges,
[RevokeeNames :=] midUserGroupList )

C++

HRESULT pStoredProcedure->Revoke (
SQLOLE_PRIVILEGE_TYPE tPrivileges,
SQLOLE_LPCSTR midUserGroupList );

Elements

Element	Type	Description
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of stored procedure privileges to revoke
midUserGroupList	MultiIdentifier	Delimited list of one or more users and groups
Reference

REVOKE


Script Method

SQLServer.Database.StoredProcedure Object

Description

Generates a series of Transact-SQL statements (script) to create the stored procedure.

Visual Basic

strScript = StoredProcedure.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pStoredProcedure->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


StoredProcedure Lists

StoredProcedure Object     Properties     Methods     Lists     Collections

EnumDependencies

EnumParameters

ListPermissions

ListUserPermissions


EnumDependencies List

SQLServer.Database.StoredProcedure Object

Description

Lists the database objects that depend on this stored procedure, or database objects that this stored procedure depends on, in dependency order. List is returned in a QueryResults object.

Visual Basic

QueryResults = StoredProcedure.EnumDependencies (
[[DependencyType :=] tDependency] )

C++

HRESULT pStoredProcedure->EnumDependencies (
LPSQLOLEDBOBJECTLIST* ppQueryResults,
SQLOLE_DEPENDENCY_TYPE tDependency = SQLOLEDep_Parents );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
tDependency	SQLOLE_DEPENDENCY_TYPE	Type of dependencies to return
QueryResults

This method can return up to three results sets.

ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oRuleDefName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oUDDTName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oObjName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2


EnumParameters List

SQLServer.Database.StoredProcedure Object

Description

Lists the parameters of a stored procedure. List is returned in a QueryResults object.

Visual Basic

QueryResults = StoredProcedure.EnumParameters

C++

HRESULT pStoredProcedure->EnumParameters ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar
name	SQLOLE_DTypeChar
length	SQLOLE_DTypeInt1
colid	SQLOLE_DTypeInt1
output	SQLOLE_DTypeInt4


ListPermissions List

SQLServer.Database.StoredProcedure Object

Description

Returns a list of Permission objects containing the privileges for this stored procedure.

Visual Basic

PermissionList = StoredProcedure.ListPermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pStoredProcedure->ListPermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList,
SQLOLE_PRIVILEGE_TYPE tPrivileges = SQLOLEPriv_Execute );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of stored procedure privileges to list
Reference

sp_helpprotect


ListUserPermissions List

SQLServer.Database.StoredProcedure Object

Description

Returns a list of Permission objects containing the specified user's privileges for this stored procedure.

Visual Basic

PermissionList = StoredProcedure.ListUserPermissions ( [UserName :=] idUser )

C++

HRESULT pStoredProcedure->ListUserPermissions (
SQLOLE_LPCSTR idUser,
LPSQLOLEPERMISSIONLIST* ppPermissionList );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
idUser	Identifier	User
Reference

sp_helpprotect


StoredProcedure Collections

StoredProcedure Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Subscription Object

SQL Server Object     Properties     Methods     Collections

Description

A Subscription object contains article objects that are replicated.


Subscription Properties

Subscription Object     Properties     Methods     Collections

Property	Description
Application Application Write: No	The Application object.
DestinationDatabase Identifier Write: Yes	The name of the destination database.
InitialSyncType SQLOLE_SUBSYNC_TYPE  Write: Yes	The type of initial synchronization event used to synchronize the subscription server.
Parent Database Write: No	The Database object.
ServerName Identifier Write: Yes	The name of the subscription server.
Status SQLOLE_SUBSTATUS_TYPE Write: Yes	The status of the subscription.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Subscription Methods

Subscription Object     Properties     Methods     Collections

BeginAlter

CancelAlter

DoAlter

Remove


BeginAlter Method

SQLServer.Database.Publication.Article.Subscription Object

Description

Marks the start of a single unit of changes to Subscription properties. Normally, each change to a single property is a separate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

Subscription.BeginAlter

C++

HRESULT pSubscription->BeginAlter ( );


CancelAlter Method

SQLServer.Database.Publication.Article.Subscription Object

Description

Stops a unit of Subscription property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

Subscription.CancelAlter

C++

HRESULT pSubscription->CancelAlter ( );


DoAlter Method

SQLServer.Database.Publication.Article.Subscription Object

Description

Commits a unit of Subscription property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

Subscription.DoAlter

C++

HRESULT pSubscription->DoAlter ( );


Remove Method

SQLServer.Database.Publication.Article.Subscription Object

Description

Drops the SQL Server subscription and the Subscription object.

Visual Basic

Subscription.Remove

C++

HRESULT pSubscription->Remove ( );

Reference

sp_dropsubscriber


Subscription Collections

Subscription Object     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


SystemDatatype Object

SystemDatatype Object     Properties     Collections

Description

A SystemDatatype object contains information about a system supplied datatype.


SystemDatatype Object Properties
SystemDatatype Properties

SystemDatatype Object     Properties     Collections

Property	Description
AllowIdentity Boolean Write: No	Indicates if the system datatype can be used as an identity column. If True, a column of this datatype can have the identity property. If False, a column of this datatype cannot have the identity property.
AllowNulls Boolean Write: No	Indicates if the system datatype can be specified to allow NULL values. If True, NULL values can be allowed. If False, NULL values cannot be allowed.
Application Application Write: No	The Application object.
IsNumeric Boolean Write: No	Indicates if the system datatype is an exact numeric datatype with a precision and scale, like the decimal and numeric datatypes. If True, it is an exact numeric datatype. If False, it is not an exact numeric datatype.
MaximumLength Long Write: No	The maximum number of bytes used to store a value of this datatype.
Name Identifier Write: No	The name of the system datatype.
Parent Database Write: No	The Database object.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


SystemDatatype Collections

SystemDatatype Object     Properties     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


TransactionLog Object

TransactionLog Object     Properties     Methods     Lists     Collections

Description

The TransactionLog object contains all the information about a database's transaction log. Each database has a single transaction log, and the TransactionLog object is a property of the Database object.


TransactionLog Properties

TransactionLog Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
CreateDate String Write: No	The date and time the transaction log was created.
IsLogOnSeparateDevice Boolean Write: No	Indicates if this transaction log is on a separate database device. If True, the transaction log is on a separate device and the Dump method can be used. If False, the transaction log is not on a separate device and the Dump method cannot be used.
LastDump String Write: No	The date and time this transaction log was last backed up.
Parent Database Write: No	The Database object.
Size Long Write: No	The total size in megabytes of the transaction log.
SpaceAvailable Long Write: No	The total space in kilobytes available for future log growth.
SpaceAvailableinMB Float Write: No	The total space in megabytes (accurate to two decimal places) available for future log growth.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


TransactionLog Methods

TransactionLog Object     Properties     Methods     Lists     Collections

DedicateLogDevices

Dump

GenerateBackupSQL

Load

SpaceAllocatedOnDevice

Truncate

UndedicateLogDevices


DedicateLogDevices Method

SQLServer.Database.TransactionLog Object

Description

Marks database devices as usable only for transaction log information.

Visual Basic

TransactionLog.DedicateLogDevices ( [DeviceNames :=] mstrDevices )

C++

HRESULT pTransactionLog->DedicateLogDevices ( SQLOLE_LPCSTR mstrDevices );

Elements

Element	Type	Description
mstrDevices	MultiString	Delimited list of one or more database device usage specifiers. Each usage specifier consists of either the database device name alone, or the database device name, an equal sign, and a size in megabytes.
Reference

ALTER DATABASE, sp_logdevice


Dump Method

SQLServer.Database.TransactionLog Object

Description

Backs up a transaction log to a dump device. Set the properties of a created Backup object as desired and pass it to the Dump method.

Visual Basic

TransactionLog.Dump ( [DumpSpec :=] Backup )

C++

HRESULT pTransactionLog->Dump ( LPSQLOLEBACKUP pBackup );

Elements

Element	Type	Description
Backup	Backup	Created Backup object that specifies how to execute transaction log backup
Reference

DUMP TRANSACTION


GenerateBackupSQL Method

SQLServer.Database.TransactionLog Object

Description

Generates a series of Transact-SQL statements that can be used to backup this TransactionLog. Set the properties of a created Backup object as desired and pass it to the GenerateBackupSQL method.

Visual Basic

strScript = TransactionLog.GenerateBackupSQL ( [DumpSpec :=] Backup )

C++

HRESULT pTransactionLog->GenerateBackupSQL (
LPSQLOLEBACKUP pBackup,
SQLOLE_LPBSTR pstrScript );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL backup script
Backup	Backup	Created Backup object that specifies how to execute the transaction log backup
Remarks

To schedule this backup script, set the Task.Command property to the string returned by this method.


Load Method

SQLServer.Database.TransactionLog Object

Description

Restores a transaction log using an existing backup from a dump device. Set the properties of a created Backup object as desired and pass it to the Load method.

Visual Basic

TransactionLog.Load ( [LoadSpec :=] Backup )

C++

HRESULT pTransactionLog->Load ( LPSQLOLEBACKUP pBackup );

Elements

Element	Type	Description
Backup	Backup	Created Backup object that specifies how to execute transaction log backup
Reference

LOAD TRANSACTION


SpaceAllocatedOnDevice Method

SQLServer.Database.TransactionLog Object

Description

Returns the total amount of storage space this transaction log has allocated on the specified device.

Visual Basic

lAllocated = TransactionLog.SpaceAllocatedOnDevice ( [DeviceName :=] idDevice )

C++

HRESULT pTransactionLog->GetSpaceAllocatedOnDevice (
SQLOLE_LPCSTR idDevice,
LPLONG plAllocated );

Elements

Element	Type	Description
lAllocated	Long	Total allocated storage space in megabytes
idDevice	Identifier	Device name
Remarks

This is an indexed property.


Truncate Method

SQLServer.Database.TransactionLog Object

Description

Removes the committed transactions from the transaction log without making a backup.

Visual Basic

TransactionLog.Truncate

C++

HRESULT pTransactionLog->Truncate ( );

Reference

DUMP TRANSACTION ... WITH TRUNCATE_ONLY


UndedicateLogDevices Method

SQLServer.Database.TransactionLog Object

Description

Marks database devices as usable for both data and transaction log information. This method can only be used on the TransactionLog of a newly created Database object before the Database is added to the SQLServer.Databases collection.

Visual Basic

TransactionLog.UndedicateLogDevices ( [DeviceNames :=] mstrDevices )

C++

HRESULT pTransactionLog->UndedicateLogDevices ( SQLOLE_LPCSTR mstrDevices );

Elements

Element	Type	Description
mstrDevices	MultiString	Delimited list of one or more database device usage specifiers. Each usage specifier consists of either the database device name alone, or the database device name, an equal sign, and a size in megabytes.


TransactionLog Lists

TransactionLog Object     Properties     Methods     Lists     Collections

ListDevices


ListDevices List

SQLServer.Database.TransactionLog Object

Description

Returns a list of Device objects used by this transaction log.

Visual Basic

DeviceList = TransactionLog.ListDevices

C++

HRESULT pTransactionLog->ListDevices ( LPSQLOLEDEVICELIST* ppDeviceList );

Elements

Element	Type	Description
DeviceList	DeviceList	Returned list of Device objects


TransactionLog Collections

TransactionLog Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


User Object

User Object     Properties     Methods     Lists     Collections

Description

A User object contains information about a database user. Each User is associated with a single SQL Server login.


User Properties

User Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
Group Identifier Write: Yes	The group this user is a member of. To set this property to a new group, the group must exist.
ID Long Write: No	The unique user ID of the database user. A user ID of 1 is the database owner.
Login Identifier Write: Before Add	The SQL Server login associated with this database user.
Name Identifier Write: Before Add	The name of the database user.
Parent Database Write: No	The Database object.
SystemObject Boolean Write: No	Indicates if this is a SQL Server system user. If True, this is a SQL Server system user (such as DBO). If False, this user was created by a user.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


User Methods

User Object     Properties     Methods     Lists     Collections

AddAlias

Remove

RemoveAlias

Script


AddAlias Method

SQLServer.Database.User Object

Description

Associates a list of existing logins with this database user. Each of the logins must not currently be associated with a database user or have an existing alias.

Visual Basic

User.AddAlias ( [LoginNames :=] midLogins )

C++

HRESULT pUser->AddAlias ( SQLOLE_LPCSTR midLogins );

Elements

Element	Type	Description
midLogins	MultiIdentifier	Delimited list of logins
Reference

sp_addalias


Remove Method

SQLServer.Database.User Object

Description

Drops the SQL Server database user and removes the User object.

Visual Basic

User.Remove

C++

HRESULT pUser->Remove ( );

Reference

sp_dropuser


RemoveAlias Method

SQLServer.Database.User Object

Description

Removes the existing alias association between a list of logins that are aliased to this database user.

Visual Basic

User.RemoveAlias ( [LoginNames :=] midLogins )

C++

HRESULT pUser->RemoveAlias ( SQLOLE_LPCSTR midLogins );

Elements

Element	Type	Description
midLogins	MultiIdentifier	Delimited list of logins
Reference

sp_dropalias


Script Method

SQLServer.Database.User Object

Description

Generates a series of Transact-SQL statements (script) to create the user.

Visual Basic

strScript = User.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pUser->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


User Lists

User Object     Properties     Methods     Lists     Collections

ListAliases

ListDatabasePermissions

ListObjectPermissions

ListOwnedObjects


ListAliases List

SQLServer.Database.User Object

Description

Returns a list of Login objects that are currently aliased to this user.

Visual Basic

LoginList = User.ListAliases

C++

HRESULT pUser->ListAliases ( LPSQLOLELOGINLIST* ppLoginList );

Elements

Element	Type	Description
LoginList	LoginList	Returned list of Login objects


ListDatabasePermissions List

SQLServer.Database.User Object

Description

Returns a list of Permission objects containing the statement privileges for this user.

Visual Basic

PermissionList = User.ListDatabasePermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pUser->ListDatabasePermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList ,
SQLOLE_PRIVILEGE_TYPE tPrivileges =
SQLOLEPriv_AllDatabasePrivs );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of statement privileges to list


ListObjectPermissions List

SQLServer.Database.User Object

Description

Returns a list of Permission objects containing the object privileges for this user.

Visual Basic

PermissionList = User.ListObjectPermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pUser->ListObjectPermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList ,
SQLOLE_PRIVILEGE_TYPE tPrivileges = SQLOLEPriv_AllObjectPrivs );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of object privileges to list


ListOwnedObjects List

SQLServer.Database.User Object

Description

Returns a list of DBObject objects that this user owns.

Visual Basic

DBObjectList = User.ListOwnedObjects (
[[ObjectTypes :=] tObjects,]
[[SortBy :=] tSortBy] )

C++

HRESULT pUser->ListOwnedObjects (
LPSQLOLEDBOBJECTLIST* ppDBObjectList,
SQLOLE_OBJECT_TYPE tObjects = SQLOLEObj_AllDatabaseObjects,
SQLOLE_OBJSORT_TYPE tSortBy = SQLOLEObjSort_Name );

Elements

Element	Type	Description
DBObjectList	DBObjectList	Returned list of DBObject objects
tObjects	SQLOLE_OBJECT_TYPE	Types of database objects to list
tSortBy	SortType	How to sort the list


User Collections

User Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


UserDefinedDatatype Object

UserDefinedDatatype Object     Properties     Methods     Lists     Collections

Description

A UserDefinedDatatype object contains information about a new datatype that has been created by the user.


UserDefinedDatatype Object Properties
UserDefinedDatatype Properties

UserDefinedDatatype Object     Properties     Methods     Lists     Collections

Property	Description
AllowIdentity Boolean Write: No	Indicates if the system datatype can be used as an identity column. If True, a column of this datatype can have the identity property. If False, a column of this datatype cannot have the identity property.
AllowNulls Boolean Write: Before Add	Determines if the user defined datatype accepts NULL values. If True, the user defined datatype allows NULL values. If False, NULL values are not allowed.
Application Application Write: No	The Application object.
BaseType Identifier Write: Before Add	The system datatype this user defined datatype is based on. To set this property to a new default, the default must exist.
Default Identifier Write: Yes	The default that is currently bound to this datatype.
ID Long Write: No	The type ID from sysobjects.usertype.
Length Long Write: Before Add	The number of bytes used to store a value of this datadatatype.
Name Identifier Write: Yes	The name of the user defined datatype.
NumericPrecision Long Write: Before Add	The precision of an exact numeric datatype.
NumericScale Long Write: Before Add	The scale of an exact numeric datatype.
Owner Identifier Write: NO	The user who created this user defined datatype.
Parent Database Write: No	The Database object.
Rule Identifier Write: Yes	The rule currently bound to this user defined datatype. To set this property to a new rule, the rule must exist.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


UserDefinedDatatype Methods

UserDefinedDatatype Object     Properties     Methods     Lists     Collections

Remove

Script


Remove Method

SQLServer.Database.UserDefinedDatatype Object

Description

Drops an existing user-defined datatype and removes the UserDefinedDatatype object.

Visual Basic

UserDefinedDatatype.Remove

C++

HRESULT pUserDefinedDatatype->Remove ( );

Reference

sp_droptype


Script Method

SQLServer.Database.UserDefinedDatatype Object

Description

Generates a series of Transact-SQL statements (script) to create the user-defined datatype.

Visual Basic

strScript = UserDefinedDatatype.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pUserDefinedDatatype->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


UserDefinedDatatype List
UserDefinedDatatype Lists

UserDefinedDatatype Object     Properties     Methods     Lists     Collections

ListBoundColumns


ListBoundColumns List

SQLServer.Database.UserDefinedDatatype Object

Description

Returns a list of Column objects that this user-defined datatype is bound to.

Visual Basic

ColumnList = UserDefinedDatatype.ListBoundColumns

C++

HRESULT pUserDefinedDatatype->ListBoundColumns ( LPSQLOLECOLUMNLIST* ppColumnList );

Elements

Element	Type	Description
ColumnList	ColumnList	Returned list of Column objects


UserDefinedDatatype Collections

UserDefinedDatatype Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Chapter 5   Table Scope Objects
Table Scope Objects

Check Object

Column Object

DRIDefault Object

Index Object

Key Object

Table Object

Trigger Object

View Object


Check Object

Check Object     Properties     Methods     Collections

Description

A Check object contains information about a check constraint. It may constrain one or more columns.


Check Properties

Check Object     Properties     Methods     Collections

Property	Description
Application Application Write: No	The Application object.
ExcludeReplication Boolean Write: Yes	Determines if this Check constraint is ignored during replication. If True, this Check is ignored for data inserted by replication. If False, this Check is enforced for data inserted by replication.
Name Identifier Write: Yes	The Check constraint name. If empty when a new Check object is added to the Table.Checks collection, one will automatically be generated.
Parent Table Write: No	The Table object.
Text String Write: Before Add	The original Transact-SQL search condition used to create this Check.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Check Methods

Check Object     Properties     Methods     Collections

Remove

Script


Remove Method

SQLServer.Database.Table.Check Object

Description

Drops the SQL Server check constraint and removes the Check object.

Visual Basic

Check.Remove

C++

HRESULT pCheck->Remove ( );


Script Method

SQLServer.Database.Table.Check Object

Description

Generates a series of Transact-SQL statements (script) to create the check constraint (using ALTER TABLE).

Visual Basic

strScript = Check.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pCheck->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


Check Collections

Check Object     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Column Object

Column Object     Properties     Methods     Lists     Collections

Description

A Column object defines a specific type of information that is maintained in a table.


Column Object Properties
Column Properties

Column Object     Properties     Methods     Lists     Collections

Property	Description
AllowNulls Boolean Write: Before Add	Determines if the column allows NULL values. If True, the column allows NULL values. If False, NULL values are not allowed in the column.
Application Application Write: No	The Application object.
DataType Identifier Write: Before Add	The system or user-defined datatype of the column.
Default Identifier Write: Yes	The default bound to the column.
DRIDefault DRIDefault Write: No	The DRIDefault object for this column.
ID Long Write: No	The column ID and ordinal number in the table.
Identity Boolean Write: Before Add	Determines if this column has the identity property. If True, this is the single identity column for this table. If False, this column does not have the identity property.
IdentityIncrement Long Write: Before Add	The value added to the previous identity value to get the next identity value.
IdentitySeed Long Write: Before Add	The value automatically assigned to the identity column of the first row inserted into the table.
InPrimaryKey Boolean Write: Before Add	Indicates if this column is part of the primary key for this table. If True, this column is part of the primary key. If False, this column is not part of the primary key.
Length Long Write: Before Add	The number of bytes used to store a value in this column.
Name Identifier Write: Yes	The column name.
NumericPrecision Long Write: Before Add	The precision of an exact numeric datatype column.
NumericScale Long Write: Before Add	The scale of an exact numeric datatype column.
Parent Table Write: No	The Table object.
PhysicalDataType Identifier Write: No	The system datatype that the user-defined datatype is based on.
Rule Identifier Write: Yes	The rule bound to the column.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Column Methods

Column Object     Properties     Methods     Lists     Collections

Remove


Remove Method

SQLServer.Database.Table.Column Object

Description

Removes the Column object from a new but not added Table.

Visual Basic

Column.Remove

C++

HRESULT pColumn->Remove ( );


Column Lists

Column Object     Properties     Methods     Lists     Collections

ListKeys


ListKeys Method

SQLServer.Database.Table.Column Object

Description

Returns a list of Key objects that include this Column.

Visual Basic

KeyList = Column.ListKeys

C++

HRESULT pColumn->ListKeys ( LPSQLOLEKEYLIST* ppKeyList );

Elements

Element	Type	Description
KeyList	KeyList	Returned list of Key objects


Column Collections

Column Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


DRIDefault Object

DRIDefault Object     Properties     Methods     Collections

Description

A DRIDefault object contains information about a default constraint for a column. A DRIDefault is a property of a Column object.


DRIDefault Properties

DRIDefault Object     Properties     Methods     Collections

Property	Description
Application Application Write: No	The Application object.
Name Identifier Write: Yes	The DRIDefault name, optional on column creation. SQL-DMO will automatically generate one if blank.
Parent Column Write: No	The Column object.
Text String Write: Yes	The Transact-SQL expression used to create this DRIDefault. If not empty when the DRIDefault property of a new Column object is added to the Table.Columns collection, the default constraint will also be created when the table and column are created; otherwise, the default constraint is not created. If set to an empty string, the DRIDefault is removed from the column.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


DRIDefault Methods

DRIDefault Object     Properties     Methods     Collections

Remove

Script


Remove Method

SQLServer.Database.Table.Column.DRIDefault Object

Description

Drops the SQL Server default constraint and removes the DRIDefault object.

Visual Basic

DRIDefault.Remove

C++

HRESULT pDRIDefault->Remove ( );


Script Method

SQLServer.Database.Table.Column.DRIDefault Object

Description

Generates a series of Transact-SQL statements (script) to create the default constraint (using ALTER TABLE).

Visual Basic

strScript = DRIDefault.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pDRIDefault->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


DRIDefault Collections

DRIDefault Object     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Index Object

Index Object     Properties     Methods     Lists     Collections

Description

An Index object is used to speed up access to a table. There are two types of indexes: a clustered index, where data is stored in the same order as the index, and a nonclustered index, where data is unordered and stored separately from the index.


Index Object Properties
Index Properties

Index Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
FillFactor Long Write: Before Add	The percent of each page that SQL Server will fill with index data when creating a new index on a table. Valid values are 0 through 100.
ID Long Write: No	The object ID of the index.
Name Identifier Write: Yes	The name of the index.
Parent Table Write: No	The Table object.
SpaceUsed Long Write: No	Storage space in kilobytes used by this index.
Type SQLOLE_INDEX_TYPE Write: Before Add	The type of index.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Index Object Methods
Index Methods

Index Object     Properties     Methods     Lists     Collections

GenerateCreationSQL

IndexedColumns

Rebuild

RecalcSpaceUsage

Remove

Script

UpdateStatistics


GenerateCreationSQL Method

SQLServer.Database.Table.Index Object

Description

Generates a series of Transact-SQL statements (script) that can be used to create this index on another table.

Visual Basic

Index.GenerateCreationSQL ( [TargetTable :=] idTargetTable )

C++

HRESULT pIndex->GenerateCreationSQL (
LPSQLOLETABLE idTargetTable,
SQLOLE_LPBSTR pstrScript );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL backup script
idTargetTable	Identifier	Table that the script will create the index on
Remarks

To schedule this index creation script, set the Task.Command property to the string returned by this method.


IndexedColumns Method

SQLServer.Database.Table.Index Object

Description

Sets the list of columns to be included in a new index.

Visual Basic

Index.IndexedColumns ( [ColumnNames :=] midColumns )

C++

HRESULT pIndex->SetIndexedColumns ( SQLOLE_LPCSTR midColumns );

Elements

Element	Type	Description
midColumns	MultiIdentifier	Delimited list of one or more columns
Remarks

This is an indexed property.


Rebuild Method

SQLServer.Database.Table.Index Object

Description

Drops and re-creates the index.

Visual Basic

Index.Rebuild

C++

HRESULT pIndex->Rebuild ( );

Remarks

If you need to redefine an Index (for example, change the fill factor or add a column), then you must first Remove the Index, then Add a new one.


RecalcSpaceUsage Method

SQLServer.Database.Table.Index Object

Description

Recalculates the latest space usage information for the index.

Visual Basic

Index.RecalcSpaceUsage

C++

HRESULT pIndex->RecalcSpaceUsage ( );


Remove Method

SQLServer.Database.Table.Index Object

Description

Drops the SQL Server index and removes the Index object.

Visual Basic

Index.Remove

C++

HRESULT pIndex->Remove ( );


Script Method

SQLServer.Database.Table.Index Object

Description

Generates a series of Transact-SQL statements (script) to create the index.

Visual Basic

strScript = Index.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pIndex->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


UpdateStatistics Method

SQLServer.Database.Table.Index Object

Description

Updates data distribution statistics for this index.

Visual Basic

Index.UpdateStatistics

C++

HRESULT pIndex->UpdateStatistics ( );

Reference

UPDATE STATISTICS


Index Object Lists
Index Lists

Index Object     Properties     Methods     Lists     Collections

EnumStatistics

ListIndexedColumns


EnumStatistics Method

SQLServer.Database.Table.Index Object

Description

Returns statistical information in the distribution page for the index.

Visual Basic

QueryResults = Index.EnumStatistics

C++

HRESULT pIndex->EnumStatistics ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

This method can return up to three results sets.

ColumnName	ColumnType
Updated	SQLOLE_DTypeChar
Rows	SQLOLE_DTypeInt4
Steps	SQLOLE_DTypeInt4
Density	SQLOLE_DTypeFloat4
ColumnName	ColumnType
All density	SQLOLE_DTypeFloat4
Columns	SQLOLE_DTypeChar
ColumnName	ColumnType
Steps	SQLOLE_DTypeChar


ListIndexedColumns List

SQLServer.Database.Table.Index Object

Description

Returns a list of Column objects that are included in this index.

Visual Basic

ColumnList = Index.ListIndexedColumns

C++

HRESULT pIndex->ListIndexedColumns ( LPSQLOLECOLUMNLIST* ppColumnList );

Elements

Element	Type	Description
ColumnList	ColumnList	Returned list of Column objects


Index Collections

Index Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Key Object

Key Object     Properties     Methods     Collections

Description

A Key object contains information about primary, unique or foreign keys of a Table. Each Key is made up of one or more columns from a table.


Key Properties

Key Object     Properties     Methods     Collections

Property	Description
Application Application Write: No	The Application object.
Clustered Boolean Write: Before Add	Determines if the unique index associated with this Key is a clustered index. If True, this Key has a unique clustered index. If False, this Key has a unique nonclustered index. The default is False.
FillFactor Long Write: Before Add	The percentage of each page that SQL Server will fill with index data when creating a unique index for a new Key. Valid values are 0 through 100.
Name Identifier Write: Yes	The name of the Key. Optional on Keys.Add; SQL-DMO will automatically generate one if blank.
Parent Table Write: No	The Table object.
ReferencedKey Identifier Write: No	The key of the ReferencedTable which this foreign key references, if this is a foreign key.
ReferencedTable Identifier Write: Yes	The table that includes columns referenced by the KeyColumns of this Key. Data values in the KeyColumns must exist in the ReferencedColumns of this table.
Type SQLOLE_KEY_TYPE  Write: Yes	The Key type.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Key Methods

Key Object     Properties     Methods     Collections

Remove

Script


Remove Method

SQLServer.Database.Table.Key Object

Description

Drops the SQL Server key and removes the Key object.

Visual Basic

Key.Remove

C++

HRESULT pKey->Remove ( );


Script Method

SQLServer.Database.Table.Key Object

Description

Generates a series of Transact-SQL statements (script) to create the key (using ALTER TABLE).

Visual Basic

strScript = Key.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pKey->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


Key Collections

Key Object     Properties     Methods     Collections

Collection	Description
KeyColumns Names Write: No	The Names collection that contains columns included in this Key.
Properties Properties Write: No	The collection of Property objects.
ReferencedColumns Names Write: No	The Names collection that contains referenced columns of the ReferencedTable property. Data values in the KeyColumns (Names) collection must exist in these columns of the ReferencedTable.


Table Object

Table Object     Properties     Methods     Lists     Collections

Description

A Table object contains rows of data in the database.


Table Object Properties
Table Properties

Table Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
Attributes SQLOLE_TABLEATT_TYPE  Write: No	The attributes of this table.
ClusteredIndex Index Write: No	The clustered Index object.
CreateDate String Write: No	The date and time this table was created.
DataSpaceUsed Long Write: No	Storage space in kilobytes used by the rows of this table.
ID Long Write: No	The object ID of the table.
IndexSpaceUsed Long Write: No	Storage space in kilobytes used by the indexes on this table.
Name Identifier Write: Yes	The name of the table.
Owner Identifier Write: No	The user who created the table.
Parent Database Write: No	The Database object.
PrimaryKey Key Write: No	The primary Key object for this table.
Rows Long Write: No	The number of rows currently in this table.
SystemObject Write:	Indicates if this is a SQL Server system table. If True, this is a SQL Server system table. If False, this table was created by a user.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Table Object Methods
Table Methods

Table Object     Properties     Methods     Lists     Collections

BeginAlter

CancelAlter

CheckTable

CheckTextAllocsFast

CheckTextAllocsFull

DoAlter

DoAlterWithNoCheck

Grant

InsertColumn

RecalcSpaceUsage

ReCompileReferences

Refresh

Remove

Revoke

Script

TruncateData

UpdateStatistics


BeginAlter Method

SQLServer.Database.Table Object

Description

Marks the start of a single unit of changes to Table properties. Normally, each change to a single property is a separate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

Table.BeginAlter

C++

HRESULT pTable->BeginAlter ( );


CancelAlter Method

SQLServer.Database.Table Object

Description

Stops a unit of Table property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

Table.CancelAlter

C++

HRESULT pTable->CancelAlter ( );


CheckTable Method

SQLServer.Database.Table Object

Description

Checks the internal consistency of the data and index pages of this table.

Visual Basic

strOutput = Table.CheckTables

C++

HRESULT pTable->CheckTables ( SQLOLE_LPBSTR pstrOutput );

Elements

Element	Type	Description
strOutput	String	The output returned by the internal consistency check
Reference

DBCC CHECKTABLE


CheckTextAllocsFast Method

SQLServer.Database.Table Object

Description

Checks the internal allocation consistency of text and image pages of this table. This check is faster than the CheckTextAllocsFull method because it only checks data in existing text and image columns.

Visual Basic

strOutput = Table.CheckTextAllocsFast

C++

HRESULT pTable->CheckTextAllocsFast ( SQLOLE_LPBSTR pstrOutput );

Elements

Element	Type	Description
strOutput	String	The output returned by the internal consistency check
Reference

DBCC TEXTALLOC (..., FAST)


CheckTextAllocsFull Method

SQLServer.Database.Table Object

Checks the internal allocation consistency of text and image pages of this table. This check is slower and more thorough than CheckTextAllocsFast method because it checks the entire table for text and image data.

Visual Basic

strOutput = Table.CheckTextAllocsFull

C++

HRESULT pTable->CheckTextAllocsFull ( SQLOLE_LPBSTR pstrOutput );

Elements

Element	Type	Description
strOutput	String	The output returned by the internal consistency check
Reference

DBCC TEXTALLOC (..., FULL)


DoAlter Method

SQLServer.Database.Table Object

Description

Commits a unit of Table property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

Table.DoAlter

C++

HRESULT pTable->DoAlter ( );


DoAlterWithNoCheck Method

SQLServer.Database.Table Object

Description

Commits a unit of Table property changes previously marked with BeginAlter using ALTER TABLE ... WITH NOCHECK. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

Table.DoAlterWithNoCheck

C++

HRESULT pTable->DoAlterWithNoCheck ( );

Remarks

To add a check constraint or foreign key constraint to a table using the WITH NOCHECK option, first call the BeginAlter method, then make the property changes, then call DoAlterWithNoCheck.

Reference

ALTER TABLE ... WITH NOCHECK


Grant Method

SQLServer.Database.Table Object

Description

Gives table privileges to a list of SQL Server users and groups.

Visual Basic

Table.Grant (
[Privileges :=] tPrivileges,
[GranteeNames :=] midUserGroupList,
[[ColumnNames :=] midColumnList] )

C++

HRESULT pTable->Grant (
SQLOLE_PRIVILEGE_TYPE tPrivileges,
SQLOLE_LPCSTR midUserGroupList,
SQLOLE_LPCSTR midColumnList = NULL );

Elements

Element	Type	Description
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of statement privileges to grant
midUserGroupList	MultiIdentifier	Delimited list of one or more users and groups
midColumnList	MultiIdentifier	Delimited list of one or more columns
Reference

GRANT


InsertColumn Method

SQLServer.Database.Table Object

Description

Inserts a new column into an existing table or a new but not added Table. To insert a new column as the last column of an existing table, first call the BeginAlter method, then call InsertColumn, then call the DoAlter method. To insert a new column into the specified position of a new Table, call InsertColumn before adding the new Table to the Database.Tables collection.

Visual Basic

Table.InsertColumn (
[NewColumn :=] Column,
[BeforeColumnName :=] idBeforeColumn )

C++

HRESULT pTable->InsertColumn (
LPSQLOLECOLUMN pColumn,
SQLOLE_LPCSTR idBeforeColumn );

Elements

Element	Type	Description
Column	Column	Column object to be inserted.
idBeforeColumn	Identifier	If not empty, the Column object will inserted before this column name. If empty, the Column object will be the last column of the table. To insert a new column into an existing table, this value must be empty.


RecalcSpaceUsage Method

SQLServer.Database.Table Object

Description

Recalculates the latest space usage information for the table.

Visual Basic

Table.RecalcSpaceUsage

C++

HRESULT pTable->RecalcSpaceUsage ( );


ReCompileReferences Method

SQLServer.Database.Table Object

Description

Causes each stored procedure and trigger that references the table to be recompiled the next time it is executed.

Visual Basic

Table.ReCompileReferences

C++

HRESULT pTable->ReCompileReferences ( );

Reference

sp_recompile


Refresh Method

SQLServer.Database.Table Object

Description

Updates Table properties with current information from SQL Server. This method will also refresh all the collections of this Table.

Visual Basic

Table.Refresh

C++

HRESULT pTable->Refresh ( );

Remarks

SQL-DMO will release only those objects in the Table collections that have been removed from SQL Server. This invalidates any object variables you have that refer to objects in the refreshed Table collections that have been removed from SQL Server.


Remove Method

SQLServer.Database.Table Object

Description

Drops the SQL Server table and removes the Table object.

Visual Basic

Table.Remove

C++

HRESULT pTable->Remove ( );

Reference

DROP TABLE


Revoke Method

SQLServer.Database.Table Object

Description

Removes table privileges from a list of SQL Server users and groups.

Visual Basic

Table.Revoke (
[Privileges :=] tPrivileges,
[RevokeeNames :=] midUserGroupList,
[[ColumnNames :=] midColumnList] )

C++

HRESULT pTable->Revoke (
SQLOLE_PRIVILEGE_TYPE tPrivileges,
SQLOLE_LPCSTR midUserGroupList,
SQLOLE_LPCSTR midColumnList = NULL );

Elements

Element	Type	Description
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of statement privileges to revoke
midUserGroupList	MultiIdentifier	Delimited list of one or more users and groups
midColumnList	MultiIdentifier	Delimited list of one or more columns
Reference

REVOKE


Script Method

SQLServer.Database.Table Object

Description

Generates a series of Transact-SQL statements (script) to create the table.

Visual Basic

strScript = Table.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile,]
[[NewName :=] strNewName] )

C++

HRESULT pTable->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPCSTR strNewName = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script
strNewName	Identifier	A new table name if desired


TruncateData Method

SQLServer.Database.Table Object

Description

Deletes all rows from this table.

Visual Basic

Table.TruncateData

C++

HRESULT pTable->TruncateData ( );

Reference

TRUNCATE TABLE


UpdateStatistics Method

SQLServer.Database.Table Object

Description

Updates data distribution statistics for all indexes on this table.

Visual Basic

Table.UpdateStatistics

C++

HRESULT pTable->UpdateStatistics ( );

Reference

UPDATE STATISTICS


Table Object Lists
Table Lists

Table Object     Properties     Methods     Lists     Collections

EnumDependencies

EnumLastStatisticsUpdates

EnumReferencedKeys

EnumReferencedTables

EnumReferencingKeys

EnumReferencingTables

ListArticles

ListPermissions

ListUserPermissions


EnumDependencies List

SQLServer.Database.Table Object

Description

Lists the database objects that depend on this Table, or database objects that this Table depends on, in dependency order. List is returned in a QueryResults object.

Visual Basic

QueryResults = Table.EnumDependencies ( [[DependencyType :=] tDependency] )

C++

HRESULT pTable->EnumDependencies (
LPSQLOLEQUERYRESULTS* ppQueryResults, SQLOLE_DEPENDENCY_TYPE tDependency = SQLOLEDep_Parents );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
tDependency	SQLOLE_DEPENDENCY_TYPE	Dependency type
QueryResults

This method can return up to three results sets.

ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oRuleDefName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oUDDTName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oObjName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2


EnumLastStatisticsUpdates List

SQLServer.Database.Table Object

Description

Lists the dates that the indexes on this table were last updated. List is returned in a QueryResults object.

Visual Basic

QueryResults = Table.EnumLastStatisticsUpdates ( [[IndexName :=] idIndex] )

C++

HRESULT pTable->EnumLastStatisticsUpdates (
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR idIndex = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object.
idIndex	Identifier	Index. The default is all indexes on the table.
QueryResults

ColumnName	ColumnType
name	SQLOLE_DTypeChar
last update	SQLOLE_DTypeDateTime
Reference

STATS_DATE


EnumReferencedKeys List

SQLServer.Database.Table Object

Description

Lists the keys of other tables that are referenced by the keys of this Table. List is returned in a QueryResults object.

Visual Basic

QueryResults = Table.EnumReferencedKeys (
[[ReferencedTableName :=] idTable,]
[[IncludeAllCandidates :=] bIncludeCandidates] )

C++

HRESULT pTable->EnumReferencedKeys (
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR idTable = NULL,
BOOL bIncludeCandidates = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
idTable	Identifier	Table to list the keys of
bIncludeCandidates	Boolean	Determines if all possible candidate tables are included in the list, even those not referenced. If True, candidate tables are included. If False, candidate tables are not included.
QueryResults

ColumnName	ColumnType
candidate_table	SQLOLE_DTypeChar
candidate_key	SQLOLE_DTypeChar
referenced	SQLOLE_DTypeBit
Remarks

The returned QueryResults contains a column indicating if a key is referenced.


EnumReferencedTables List

SQLServer.Database.Table Object

Description

Lists the tables that are referenced by they keys of this Table. List is returned in a QueryResults object.

Visual Basic

QueryResults = Table.EnumReferencedTables ( [[IncludeAllCandidates :=] bIncludeCandidates] )

C++

HRESULT pTable->EnumReferencedTables (
LPSQLOLEQUERYRESULTS* ppQueryResults,
BOOL bIncludeCandidates = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
bIncludeCandidates	Boolean	Determines if all possible candidate tables are included in the list, even those not referenced. If True, candidate tables are included. If False, candidate tables are not included.
QueryResults

ColumnName	ColumnType
candidate_table	SQLOLE_DTypeChar
candidate_key	SQLOLE_DTypeChar
referenced	SQLOLE_DTypeBit
Remarks

The returned QueryResults contains a column indicating if a key is referenced.


EnumReferencingKeys List

SQLServer.Database.Table Object

Description

Lists the keys of other tables that reference this Table. List is returned in a QueryResults object.

Visual Basic

QueryResults = Table.EnumReferencingKeys (
[[ReferencedTableName :=] idTable,]
[[IncludeAllCandidates :=] bIncludeCandidates] )

C++

HRESULT pTable->EnumReferencingKeys (
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR idTable = NULL,
BOOL bIncludeCandidates = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
idTable	Identifier	Table to list the keys of
bIncludeCandidates	Boolean	Determines if all possible candidate tables are included in the list, even those not referenced. If True, candidate tables are included. If False, candidate tables are not included.
QueryResults

ColumnName	ColumnType
candidate_table	SQLOLE_DTypeChar
candidate_key	SQLOLE_DTypeChar
referenced	SQLOLE_DTypeBit
Remarks

The returned QueryResults contains a column indicating if a key is referenced.


EnumReferencingTables List

SQLServer.Database.Table Object

Description

Lists the other tables that reference this Table. List is returned in a QueryResults object.

Visual Basic

QueryResults = Table.EnumReferencingTables ( [[IncludeAllCandidates :=] bIncludeCandidates] )

C++

HRESULT pTable->EnumReferencingTables (
LPSQLOLEQUERYRESULTS * ppQueryResults,
BOOL bIncludeCandidates = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
bIncludeCandidates	Boolean	Determines if all possible candidate tables are included in the list, even those not referenced. If True, candidate tables are included. If False, candidate tables are not included.
QueryResults

ColumnName	ColumnType
candidate_table	SQLOLE_DTypeChar
candidate_key	SQLOLE_DTypeChar
referenced	SQLOLE_DTypeBit
Remarks

The returned QueryResults contains a column indicating if a key is referenced.


ListArticles List

SQLServer.Database.Table Object

Description

Returns a list of Article objects that publish this table for replication.

Visual Basic

ArticleList = Table.ListArticles

C++

HRESULT pTable->ListArticles ( LPSQLOLEARTICLELIST* ppArticleList );

Elements

Element	Type	Description
ArticleList	ArticleList	Returned list of Article objects


ListPermissions List

SQLServer.Database.Table Object

Description

Returns a list of Permission objects containing the object privileges for this table.

Visual Basic

PermissionList = Table.ListPermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pTable->ListPermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList,
SQLOLE_PRIVILEGE_TYPE tPrivileges = SQLOLEPriv_AllObjectPrivs );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of object privileges to list


ListUserPermissions List

SQLServer.Database.Table Object

Description

Returns a list of Permission objects containing the specified user's privileges for this table.

Visual Basic

PermissionList = Table.ListUserPermissions ( [UserName :=] idUser )

C++

HRESULT pTable->ListUserPermissions (
SQLOLE_LPCSTR idUser,
LPSQLOLEPERMISSIONLIST* ppPermissionList );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
idUser	Identifier	User


Table Collections

Table Object     Properties     Methods     Lists     Collections

Property	Description
Checks Checks Write: No	The collection of Check objects.
Columns Columns Write: No	The collection of Column objects.
Indexes Indexes Write: No	The collection of Index objects.
Keys Keys Write: No	The collection of Key objects.
Properties Properties Write: No	The collection of Property objects.
Triggers Triggers Write: No	The collection of Trigger objects.


Trigger Object

Trigger Object     Properties     Methods     Lists     Collections

Description

A Trigger object contains Transact-SQL statements that are executed when data in a specific table is inserted, updated, or deleted.


Trigger Properties

Trigger Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
CreateDate String Write: No	The date and time the trigger was created.
ID Long Write: No	The object ID of the trigger.
Name Identifier Write: Yes	The name of the trigger.
Owner Identifier Write: No	The user who created the trigger.
Parent Table Write: No	The Table object.
SystemObject Boolean Write: No	Indicates if this is a SQL Server system trigger. If True, this is a SQL Server system trigger. If False, this trigger was created by a user.
Text String Write: Before Add	The Transact-SQL statements used to create the trigger.
Type SQLOLE_TRIGGER_TYPE  Write: Before Add	The type of trigger.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Trigger Methods

Trigger Object     Properties     Methods     Lists     Collections

Remove

Script


Remove Method

SQLServer.Database.Table.Trigger Object

Description

Drops the SQL Server trigger and removes the Trigger object.

Visual Basic

Trigger.Remove

C++

HRESULT pTrigger->Remove ( );

Reference

DROP TRIGGER


Script Method

SQLServer.Database.Table.Trigger Object

Description

Generates a series of Transact-SQL statements (script) to create the trigger.

Visual Basic

strScript = Trigger.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pTrigger->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


Trigger List
Trigger Object List

Trigger Object     Properties      Methods     Lists     Collections

EnumDependencies


EnumDependencies List

SQLServer.Database.Table.Trigger Object

Description

Lists the database objects that depend on this Trigger, or database objects that this Trigger depends on, in dependency order. List is returned in a QueryResults object.

Visual Basic

QueryResults = Trigger.EnumDependencies ( [[DependencyType :=] tDependency] )

C++

HRESULT pTrigger->EnumDependencies (
LPSQLOLEQUERYRESULTS* ppQueryResults, SQLOLE_DEPENDENCY_TYPE tDependency = SQLOLEDep_Parents );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
tDependency	SQLOLE_DEPENDENCY_TYPE	Dependency type
QueryResults

This method can return up to three results sets.

ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oRuleDefName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oUDDTName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oObjName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2


Trigger Collections

Trigger Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


View Object

View Object     Properties     Methods     Lists     Collections

Description

A View object is logically similar to a table. It is defined by a SELECT statement (the Text property) that includes specific columns (either actual or aggregated) from one or more tables in a database.


View Object Properties
View Properties

View Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
CreateDate String Write: No	The date and time the view was created.
ID Long Write: No	The object ID of the view.
Name Identifier Write: Yes	The name of the view.
Owner Identifier Write: No	The user who created the view.
Parent Database Write: No	The Database object.
SystemObject Boolean Write: No	Indicates if this is a SQL Server system view. If True, this is a SQL Server system view. If False, this view was created by a user.
Text LargeText Write: Before Add	The original Transact-SQL statement used to create the view.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


View Object Methods
View Methods

View Object     Properties     Methods     Lists     Collections

Grant

Remove

Revoke

Script


Grant Method

SQLServer.Database.View Object

Description

Gives view privileges to a list of SQL Server users and groups.

Visual Basic

View.Grant (
[Privileges :=] tPrivileges,
[GranteeNames :=] midUserGroupList,
[[ColumnNames :=] midColumnList] )

C++

HRESULT pView->Grant (
SQLOLE_PRIVILEGE_TYPE tPrivileges,
SQLOLE_LPCSTR midUserGroupList,
SQLOLE_LPCSTR midColumnList = NULL );

Elements

Element	Type	Description
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of statement privileges to grant
midUserGroupList	MultiIdentifier	Delimited list of one or more users and groups
midColumnList	MultiIdentifier	Delimited list of one or more columns
Reference

GRANT


Remove Method

SQLServer.Database.View Object

Description

Drops the SQL Server view and removes the View object.

Visual Basic

View.Remove

C++

HRESULT pView->Remove ( );

Reference

DROP VIEW


Revoke Method

SQLServer.Database.View Object

Description

Removes view privileges from a list of SQL Server users and groups.

Visual Basic

View.Revoke (
[Privileges :=] tPrivileges,
[RevokeeNames :=] midUserGroupList,
[[ColumnNames :=] midColumnList] )

C++

HRESULT pView->Revoke (
SQLOLE_PRIVILEGE_TYPE tPrivileges,
SQLOLE_LPCSTR midUserGroupList,
SQLOLE_LPCSTR midColumnList = NULL );

Elements

Element	Type	Description
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of statement privileges to revoke
midUserGroupList	MultiIdentifier	Delimited list of one or more users and groups
midColumnList	MultiIdentifier	Delimited list of one or more columns
Reference

REVOKE


Script Method

SQLServer.Database.View Object

Description

Generates a series of Transact-SQL statements (script) to create the view.

Visual Basic

strScript = View.Script (
[[ScriptType :=] tScriptType,]
[[ScriptFilePath :=] strFile] )

C++

HRESULT pView->Script (
SQLOLE_SCRIPT_TYPE tScriptType = SQLOLEScript_Default,
SQLOLE_LPCSTR strFile = NULL,
SQLOLE_LPBSTR pstrScript = NULL );

Elements

Element	Type	Description
strScript	String	Generated Transact-SQL script
tScriptType	SQLOLE_SCRIPT_TYPE	Type of script to generate
strFile	String	Full path and file name to use to store the Transact-SQL script


View Object Lists
View Lists

View Object     Properties     Methods     Lists     Collections

EnumDependencies

ListColumns

ListPermissions

ListUserPermissions


ListColumns List

SQLServer.Database.View Object

Description

Returns a list of Column objects that are contained in this view.

Visual Basic

ColumnList = View.ListColumns

C++

HRESULT pView->ListColumns ( LPSQLOLECOLUMNLIST* ppColumnList );

Elements

Element	Type	Description
ColumnList	ColumnList	Returned list of Column objects
Remarks

The InPrimaryKey property of the Column objects in the list cannot be read.


EnumDependencies List

SQLServer.Database.View Object

Description

Lists the database objects that depend on this View, or database objects that this View depends on, in dependency order. List is returned in a QueryResults object.

Visual Basic

QueryResults = View.EnumDependencies ( [[DependencyType :=] tDependency] )

C++

HRESULT pView->EnumDependencies (
LPSQLOLEQUERYRESULTS* ppQueryResults, SQLOLE_DEPENDENCY_TYPE tDependency = SQLOLEDep_Parents );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
tDependency	SQLOLE_DEPENDENCY_TYPE	Dependency type
QueryResults

This method can return up to three results sets.

ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oRuleDefName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oUDDTName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2
ColumnName	ColumnType
oType	SQLOLE_DTypeInt4
oObjName	SQLOLE_DTypeChar
oOwner	SQLOLE_DTypeChar
oSequence	SQLOLE_DTypeInt2


ListPermissions List

SQLServer.Database.View Object

Description

Returns a list of Permission objects containing the object privileges for this view.

Visual Basic

PermissionList = View.ListPermissions ( [[PrivilegeTypes :=] tPrivileges] )

C++

HRESULT pView->ListPermissions (
LPSQLOLEPERMISSIONLIST* ppPermissionList,
SQLOLE_PRIVILEGE_TYPE tPrivileges = SQLOLEPriv_AllObjectPrivs );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
tPrivileges	SQLOLE_PRIVILEGE_TYPE	Types of object privileges to list
Reference

sp_helpprotect


ListUserPermissions List

SQLServer.Database.View Object

Description

Returns a list of Permission objects containing the specified user's privileges for this view.

Visual Basic

PermissionList = View.ListUserPermissions ( [UserName :=] idUser )

C++

HRESULT pView->ListUserPermissions (
SQLOLE_LPCSTR idUser,
LPSQLOLEPERMISSIONLIST* ppPermissionList );

Elements

Element	Type	Description
PermissionList	PermissionList	Returned list of Permission objects
idUser	Identifier	User
Reference

sp_helpprotect


View Collections

View Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Chapter 6   Service Scope Objects
Service Scope Objects

Alert Object

AlertSystem Object

Executive Object

IntegratedSecurity Object

Operator Object

Registry Object

Task Object


Alert Object

Alert Object     Properties     Methods     Lists     Collections

An Alert object contains all the information that defines a SQL Server alert.


Alert Properties

Alert Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
CountResetDate Date Write: Yes	The date and time the OccuranceCount property was last set to zero.
DatabaseName Identifier Write: Yes	The database for this alert. If specified, this alert will fire only for events in this database.
DelayBetweenResponses Long Write: Yes	The delay in seconds between the previous response and the next response for a recurring alert. Set this property to limit the number of responses for the same event.
Enabled Boolean Write: Yes	Determines if the alert is active. If True, this alert is active and can be fired by SQL Executive. If False, this alert is disabled and will not fire.
EventCategory String Write: No	Reserved. Do not change this property.
EventDescriptionKeyword String Write: Yes	A string to do a case-insensitive search for in the event description. If specified, this alert will fire only for events which have a description that contains this string.
EventID String Write: No	Reserved. Do not change this property.
EventSource String Write: No	Reserved. Do not change this property. (Currently "MSSQLServer").
HasEmailNotification Long Write: No	The number of operators that receive e-mail notification when this alert fires.
HasPagerNotification Long Write: No	The number of operators that receive pager notification when this alert fires.
ID Long Write: No	The alert ID.
IncludeEventDescription NotifyType Write: Yes	The notification types in which to include the event description.
LastOccuranceDate Date Write: Yes	The date and time when this alert was last fired.
LastResponseDate Date Write: Yes	The date and time when a response last occurred for this alert. This is affected by the DelayBetweenResponses property.
MessageID Long Write: Yes	The SQL Server message number that will fire this alert. If you specify the MessageID property you cannot specify the Severity property.
Name String Write: Yes	The alert name. It must be unique.
NotificationMessage String Write: Yes	The custom text (maximum of 255 characters) to send along with the response when this alert is fired.
OccuranceCount Long Write: Yes	The number of times this alert has been fired since the date and time specified by the CountResetDate property. To clear this count, set this property to zero.
Parent SQLServer Write: No	The SQLServer object.
Severity Long Write: Yes	The SQL Server message severity that will fire this event. If you specify the Severity property you cannot specify the MessageID property.
TaskName String Write: Yes	The task to execute when this alert is fired.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Alert Methods

Alert Object     Properties     Methods     Lists     Collections

AddNotification

BeginAlter

CancelAlter

DoAlter

Refresh

Remove

RemoveNotification

UpdateNotification


AddNotification Method

SQLServer.Alert Object

Description

Adds a new operator to the list of operators to notify when this Alert fires.

Visual Basic

Alert.AddNotification (
[OperatorName :=] strOperator,
[NotifyMethod :=] tNotify )

C++

HRESULT pAlert->AddNotification (
SQLOLE_LPCSTR strOperator,
SQLOLE_NOTIFY_TYPE tNotify );

Elements

Element	Type	Description
strOperator	String	Operator to notify when this alert fires
tNotify	SQLOLE_NOTIFY_TYPE	Type of notification to use
Reference

sp_addnotification


BeginAlter Method

SQLServer.Alert Object

Description

Marks the start of a single unit of changes to Alert properties. Normally, each change to a single property is a separate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter) call the CancelAlter method.

Visual Basic

Alert.BeginAlter

C++

HRESULT pAlert->BeginAlter ( );


CancelAlter Method

SQLServer.Alert Object

Description

Cancels a unit of Alert property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

Alert.CancelAlter

C++

HRESULT pAlert->CancelAlter ( );


DoAlter Method

SQLServer.Alert Object

Description

Commits a unit of Alert property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

Alert.DoAlter

C++

HRESULT pAlert->DoAlter ( );


Refresh Method

SQLServer.Alert Object

Description

Updates Alert properties with current values from SQL Server.

Visual Basic

Alert.Refresh

C++

HRESULT pAlert->Refresh ( );


Remove Method

SQLServer.Alert Object

Description

Drops the SQL Server alert and removes the Alert object.

Visual Basic

Alert.Remove

C++

HRESULT pAlert->Remove ( );

Reference

sp_dropalert


RemoveNotification Method

SQLServer.Alert Object

Description

Removes an operator from the list of operators to notify when this Alert fires.

Visual Basic

Alert.RemoveNotification ( [OperatorName :=] strOperator )

C++

HRESULT pAlert->RemoveNotification ( SQLOLE_LPCSTR strOperator );

Elements

Element	Type	Description
strOperator	String	Operator to remove
Reference

sp_dropnotification


UpdateNotification Method

SQLServer.Alert Object

Description

Updates the notification method of an operator that is already on the list of operators to notify when this Alert fires.

Visual Basic

Alert.UpdateNotification (
[OperatorName :=] strOperator,
[NotifyMethod :=] tNotify );

C++

HRESULT pAlert->UpdateNotification (
SQLOLE_LPCSTR strOperator,
SQLOLE_NOTIFY_TYPE tNotify );

Elements

Element	Type	Description
strOperator	String	Operator to notify when this alert fires
tNotify	SQLOLE_NOTIFY_TYPE	Type of notification to use
Reference

sp_updatealert, sp_updatenotification


Alert Lists

Alert Object     Properties     Methods     Lists     Collections

EnumNotifications


EnumNotifications List

SQLServer.Alert Object

Description

Lists the operator notifications for this Alert. List is returned in a QueryResults object.

Visual Basic

QueryResults = Alert.EnumNotifications (
[NotifyMethod :=] tNotify,
[OperatorsToEnum :=] tOperators,
[[OperatorName :=] strOperator] )

C++

HRESULT pAlert->EnumNotifications (
SQLOLE_NOTIFY_TYPE tNotify,
SQLOLE_ENUMNOTIFY_TYPE tOperators,
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR strOperator = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object.
tNotify	SQLOLE_NOTIFY_TYPE	Type of notification to list.
tOperators	SQLOLE_ENUMNOTIFY_TYPE	Which operators to list.
strOperator	String	Specific operator. This parameter is used only when tOperators is SQLOLEEnumNotify_Target.
QueryResults

ColumnName	ColumnType
operator_id	SQLOLE_DTypeInt4
operator_name	SQLOLE_DTypeChar
use_email	SQLOLE_DTypeInt4
use_pager	SQLOLE_DTypeInt4
has_email	SQLOLE_DTypeBit
has_pager	SQLOLE_DTypeBit
Reference

sp_helpnotification


Alert Collections

Alert Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


AlertSystem Object

AlertSystem Object     Properties     Methods     Collections

Description

The AlertSystem object contains information about the alert engine. The AlertSystem object is a property of the Executive object.


AlertSystem Properties

AlertSystem Object     Properties     Methods     Collections

Property	Description
Application Application Write: No	The Application object.
FailSafeOperator Identifier Write: Yes	The operator to notify if, when an Alert fires, no operators are defined or available for that Alert.
ForwardingServer Identifier Write: Yes	The SQL Server that is providing Alert services for this SQLServer.
ForwardingSeverity Long Write: Yes	Alerts with a severity of this property value or higher will be forwarded to the ForwardingServer. Valid severity values are 1 through 25, 110, 120, 130, and 140.
NotificationMethod Write: Yes	Type of notification to use when the FailSafeOperator is notified.
PagerCCTemplate String Write: Yes	The template for creating the CC line of a pager notification. If this property contains the string "<#A#>", the AlertSystem will replace this string with the PagerAddress value of the Operator that this pager notification is sent to.
PagerSendSubjectOnly Boolean Write: Yes	Determines if only the subject line is sent with pager notifications. If True, only the subject line (and no message text) is sent with the pager notification. If True, the subject line and the message text are sent with the pager notification.
PagerSubjectTemplate String Write: Yes	The template for creating the Subject line of a pager notification. If this property contains the string "<#S#>", the AlertSystem will replace this string with the alert subject before this pager notification is sent. If empty, the AlertSystem will use the alert subject.
PagerToTemplate String Write: Yes	The template for creating the To line of a pager notification. If this property contains the string "<#A#>", the AlertSystem will replace this string with the PagerAddress value of the Operator that this pager notification is sent to. If empty, the AlertSystem will use the PagerAddress of the Operator.
Parent Executive Write: No	The Executive object.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


AlertSystem Methods

AlertSystem Object     Properties     Methods     Collections

BeginAlter

CancelAlter

DoAlter

Refresh


BeginAlter Method

SQLServer.Executive.AlertSystem Object

Description

Marks the start of a single unit of changes to AlertSystem properties. Normally, each change to a single property is a seperate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

AlertSystem.BeginAlter

C++

HRESULT pAlertSystem->BeginAlter ( );


CancelAlter Method

SQLServer.Executive.AlertSystem Object

Description

Stops a unit of AlertSystem property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

AlertSystem.CancelAlter

C++

HRESULT pAlertSystem->CancelAlter ( );


DoAlter Method

SQLServer.Executive.AlertSystem Object

Description

Commits a unit of AlertSystem property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

AlertSystem.DoAlter

C++

HRESULT pAlertSystem->DoAlter ( );


Refresh Method

SQLServer.Executive.AlertSystem Object

Description

Updates AlertSystem properties with current information from SQL Server.

Visual Basic

AlertSystem.Refresh

C++

HRESULT pAlertSystem->Refresh ( );


AlertSystem Collections

AlertSystem     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Executive Object

Executive Object     Properties     Methods     Lists     Collections

Description

The Executive object contains information about the scheduling engine used to schedule tasks and alerts.


Executive Properties

Executive Object     Properties     Methods     Lists     Collections

Property	Description
AlertSystem AlertSystem Write: No	The AlertSystem object.
Application Application Write: No	The Application object.
AutoStart Boolean Write: Yes	Determines if the Executive service starts automatically when Windows NT starts. If True, the Executive starts when Windows NT starts. If False, the Executive must be started manually.
LimitHistoryRows Boolean Write: Yes	Determines if old task history rows (in the syshistory table) are overwritten with new ones. If True, the LimitHistoryRowsMax property limits the number of rows. If False, there is no limit to the number of rows.
LimitHistoryRowsMax Long Write: Yes	The maximum number of task history rows (in the syshistory table) to keep. When this number is exceeded, old task history rows are purged to make room for new ones.
Parent SQLServer Write: No	The SQLServer object.
RestartSQLServer Boolean Write: Yes	Determines if the Exective service will automatically restart SQL Server. If True, the Executive will restart SQL Server when it detects that SQL Server has stopped unexpectedly. If False, the Executive will not attempt to restart SQL Server.
RestartSQLServerInterval Long Write: Yes	The time in minutes between checks made by the Executive to confirm that SQL Server is still running. Valid values are 1 through 60. This property is only used when RestartSQLServer is True.
Status SQLOLE_SVCSTATUS_TYPE  Write: No	Service status.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Executive Methods

Executive Object     Properties     Methods     Lists     Collections

BeginAlter

CancelAlter

DoAlter

ReassignLoginTasks

Refresh

RemoveLoginTasks

Start

Stop


BeginAlter Method

SQLServer.Executive Object

Description

Marks the start of a single unit of changes to Executive properties. Normally, each change to a single property is a seperate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

Executive.BeginAlter

C++

HRESULT pExecutive->BeginAlter ( );


CancelAlter Method

SQLServer.Executive Object

Description

Stops a unit of Executive property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

Executive.CancelAlter

C++

HRESULT pExecutive->CancelAlter ( );


DoAlter Method

SQLServer.Executive Object

Description

Commits a unit of Executive property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

Executive.DoAlter

C++

HRESULT pExecutive->DoAlter ( );


ReassignLoginTasks Method

SQLServer.Executive Object

Description

Reassigns all tasks currently owned by the specified login to a new login.

Visual Basic

Executive.ReassignLoginTasks (
[OldLogin :=] idOldLogin,
[NewLogin :=] idNewLogin )

C++

HRESULT pExecutive->ReassignLoginTasks (
SQLOLE_LPCSTR idOldLogin,
SQLOLE_LPCSTR idNewLogin );

Elements

Element	Type	Description
idOldLogin	Identifier	Login of current owner
idNewLogin	Identifier	Login of new owner


Refresh Method

SQLServer.Executive Object

Description

Updates Executive properties with current information from SQL Server.

Visual Basic

Executive.Refresh

C++

HRESULT pExecutive->Refresh ( );


RemoveLoginTasks Method

SQLServer.Executive Object

Description

Drops and removes all tasks owned by a specific login.

Visual Basic

Executive.RemoveLoginTasks ( [Login :=] idLogin )

C++

HRESULT pExecutive->RemoveLoginTasks ( SQLOLE_LPCSTR idLogin );

Elements

Element	Type	Description
idLogin	Identifier	Login


Start Method

SQLServer.Executive Object

Description

Starts a stopped Executive service.

Visual Basic

Executive.Start

C++

HRESULT pExecutive->Start ( );


Stop Method

SQLServer.Executive Object

Description

Stops a running Executive service.

Visual Basic

Executive.Stop

C++

HRESULT pExecutive->Stop ( );


Executive Lists

Executive Object     Properties     Methods     Lists     Collections

EnumQueuedTasks

EnumSubSystems

ListSubSystemTasks


EnumQueuedTasks List

SQLServer.Executive Object

Description

Lists tasks currently executing. List is returned in a QueryResults object.

Visual Basic

QueryResults = Executive.EnumQueuedTasks

C++

HRESULT pExecutive->EnumQueuedTasks ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
Value	SQLOLE_DTypeChar
Data	SQLOLE_DTypeChar


EnumSubSystems List

SQLServer.Executive Object

Description

Lists Executive subsystems. List is returned in a QueryResults object.

Visual Basic

QueryResults = Executive.EnumSubSystems

C++

HRESULT pExecutive->EnumSubSystems ( LPSQLOLEQUERYRESULTS* ppQueryResults );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
QueryResults

ColumnName	ColumnType
Value	SQLOLE_DTypeChar
Data	SQLOLE_DTypeChar


ListSubSystemTasks List

SQLServer.Executive Object

Description

Returns a list of Task objects for a specific subsystem.

Visual Basic

TaskList = Executive.ListSubSystemTasks ( [SubSystem :=] strSubSystem )

C++

HRESULT pExecutive->ListSubSystemTasks (
SQLOLE_LPCSTR strSubSystem,
LPSQLOLETASKLIST* ppDBObjectList );

Elements

Element	Type	Description
TaskList	TaskList	Returned list of Task objects
strSubSystem	String	Subsystem to list tasks of. Can be "Distribution", "LogReader", or "Sync".


Executive Collections

Executive Object     Properties     Methods     Lists     Collections

Property	Description
Properties Properties Write: No	The collection of Property objects.
Tasks Tasks Write: No	The collection of Task objects.


IntegratedSecurity Object

IntegratedSecurity Object     Properties     Methods     Lists     Collections

Description

The IntegratedSecurity object contains all the information about how SQL Server security and logins are integrated with Windows NT group and user accounts.


IntegratedSecurity Properties

IntegratedSecurity Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
AuditLevel  SQLOLE_AUDIT_TYPE Write: Yes	The audit level.
DefaultDomain String Write: Yes	The default Windows NT domain name used for trusted connections. For Windows NT user accounts from this domain, SQL Server uses the Windows NT username alone when attempting to find a matching SQL Server login. For Windows NT user accounts not from this DefaultDomain, SQL Server adds that user's Windows NT domain name and an underscore to the front of the Windows NT username when attempting to find a matching SQL Server login.
DefaultLogin Identifier Write: Yes	The default SQL Server login used for trusted connections when the Windows NT username does not match any of the existing SQL Server logins.
ImpersonateClient Boolean Write: Yes	Determines if xp_cmdshell impersonates the security context of the client connection. If True, xp_cmdshell runs in the security context of the client connection. If False, xp_cmdshell runs in the security context of the SQL Server. The default is False.
MapDollarSign String Write: Yes	Which one of several special characters in a Windows NT username is automatically mapped to a dollar sign ($) character in the SQL Server login. This value may be "domain separator", "space", "null", or any single character.
MapPoundSign String Write: Yes	Which one of several special characters in a Windows NT username is automatically mapped to a pound sign (#) character in the SQL Server login. This value may be "domain separator", "space", "null", or any single character.
MapUnderscore String Write: Yes	Which one of several special characters in a Windows NT username is automatically mapped to an underscore (_) character in the SQL Server login. This value may be "domain separator", "space", "null", or any single character.
Parent SQLServer Write: No	The SQLServer object.
SecurityMode SQLOLE_SECURITY_TYPE Write: Yes	The login security mode.
SetHostName Boolean Write: Yes	Determines if SQL Server uses the Windows NT username as the host name for trusted connections. If True, the host name is always the Windows NT username. If False, the host name is whatever value is specified by the client application.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


IntegratedSecurity Methods

IntegratedSecurity Object     Properties     Methods     Lists     Collections

GrantNTLogin

Refresh

RevokeNTLogin


GrantNTLogin Method

SQLServer.IntegratedSecurity Object

Description

Gives a Windows NT group or user account access to SQL Server.

Visual Basic

IntegratedSecurity.GrantNTLogin (
[Account :=] strAccount,
[[LoginType :=] tLoginType] )

C++

HRESULT pIntegratedSecurity->GrantNTLogin (
SQLOLE_LPCSTR strAccount,
SQLOLE_INTSECLOGIN_TYPE tLoginType =
SQLOLEIntSecLogin_User );

Elements

Element	Type	Description
strAccount	String	Windows NT group or user account
tLoginType	SQLOLE_INTSECLOGIN_TYPE	Login type
Reference

xp_grantlogin


Refresh Method

SQLServer.IntegratedSecurity Object

Description

Updates IntegratedSecurity properties with current values from SQL Server.

Visual Basic

IntegratedSecurity.Refresh

C++

HRESULT pIntegratedSecurity->Refresh ( );


RevokeNTLogin Method

SQLServer.IntegratedSecurity Object

Description

Revokes existing SQL Server access from a Windows NT group or user account access. The Windows NT group or user account must have previously been given access to SQL Server using the GrantNTLogin method.

Visual Basic

IntegratedSecurity.RevokeNTLogin ( [Account :=] strAccount )

C++

HRESULT pIntegratedSecurity->RevokeNTLogin ( SQLOLE_LPCSTR strAccount );

Elements

Element	Type	Description
strAccount	String	Windows NT group or user account
Reference

xp_revokelogin


IntegratedSecurity Lists

IntegratedSecurity Object     Properties     Methods     Lists     Collections

EnumAccountInfo

EnumNTDomainGroups


EnumAccountInfo List

SQLServer.IntegratedSecurity Object

Description

Lists information about a Windows NT group or user account and how it is used by SQL Server. List is returned in a QueryResults object.

Visual Basic

QueryResults = IntegratedSecurity.EnumAccountInfo (
[[Account :=] strAccount,]
[[ListAll :=] bListAll] )

C++

HRESULT pIntegratedSecurity->EnumAccountInfo ( LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR strAccount = NULL,
BOOL bListAll = FALSE );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
strAccount	String	Windows NT group or user account
bListAll	Boolean	Determines if information is returned for all Windows NT groups
QueryResults

ColumnName	ColumnType
account name	SQLOLE_DTypeChar
type	SQLOLE_DTypeChar
privilege	SQLOLE_DTypeChar
mapped login name	SQLOLE_DTypeChar
permission path	SQLOLE_DTypeChar
Reference

xp_logininfo


EnumNTDomainGroups List

SQLServer.IntegratedSecurity Object

Description

Lists the Windows NT groups that are defined in a specified Windows NT domain. List is returned in a QueryResults object.

Visual Basic

QueryResults = IntegratedSecurity.EnumNTDomainGroups ( [[Domain :=] strDomain] )

C++

HRESULT pIntegratedSecurity->EnumNTDomainGroups ( LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR strDomain = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
strDomain	String	Windows NT domain
QueryResults

ColumnName	ColumnType
group	SQLOLE_DTypeChar
comment	SQLOLE_DTypeChar
Reference

xp_enumgroups


IntegratedSecurity Collections

IntegratedSecurity Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Operator Object

Operator Object     Properties     Methods     Lists     Collections

Description

An Operator object contains all the information about a SQL Server operator.


Operator Properties

Operator Object     Properties     Methods     Lists     Collections

Property	Description
Application Application Write: No	The Application object.
EmailAddress String Write: Yes	The email name (address) for this operator.
Enabled Boolean Write: Yes	Determines if this operator is available to receive alert notifications. If True, this operator can receive notifications when an alert fires. If False, this operator will not receive any alert notifications.
ID Long Write: No	The operator ID.
LastEmailDate Date Write: No	The date and time this operator last received an email alert notification.
LastPageDate Date Write: No	The date and time this operator last received a pager alert notification.
Name String Write: Yes	The operator name.
PagerDays SQLOLE_WEEKDAY_TYPE  Write: Yes	The days of the week during which this operator is available to receive a pager alert notification.
PagerAddress String Write: Yes	The pager email address.
Parent SQLServer Write: No	The SQLServer object.
SaturdayPagerEndTime Date Write: Yes	The time of day on Saturday before which this operator is available to receive a pager alert notification.
SaturdayPagerStartTime Date Write: Yes	The time of day on Saturday after which this operator is available to receive a pager alert notification.
SundayPagerEndTime Date Write: Yes	The time of day on Sunday before which this operator is available to receive a pager alert notification.
SundayPagerStartTime Date Write: Yes	The time of day on Sunday after which this operator is available to receive a pager alert notification.
WeekdayPagerEndTime Date Write: Yes	The time of day on a weekday (Monday through Friday) before which this operator is available to receive a pager alert notification.
WeekdayPagerStartTime Date Write: Yes	The time of day on a weekday (Monday through Friday) after which this operator is available to receive a pager alert notification.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Operator Methods

Operator Object     Properties     Methods     Lists     Collections

AddNotification

BeginAlter

CancelAlter

DoAlter

Refresh

Remove

RemoveNotification

UpdateNotification


AddNotification Method

SQLServer.Operator Object

Description

Adds a new alert to the list of alerts that notify this operator when the alert fires.

Visual Basic

Operator.AddNotification (
[AlertName :=] strAlert,
[NotifyMethod :=] tNotify )

C++

HRESULT pOperator->AddNotification (
SQLOLE_LPCSTR strAlert,
SQLOLE_NOTIFY_TYPE tNotify );

Elements

Element	Type	Description
strAlert	String	Alert that will notify this Operator when the alert fires
tNotify	SQLOLE_NOTIFY_TYPE	Type of notification to use
Reference

sp_addnotification


BeginAlter Method

SQLServer.Operator Object

Description

Marks the start of a single unit of changes to Operator properties. Normally, each change to a single property is a seperate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

Operator.BeginAlter

C++

HRESULT pOperator->BeginAlter ( );


CancelAlter Method

SQLServer.Operator Object

Description

Cancels a unit of Operator property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

Operator.CancelAlter

C++

HRESULT pOperator->CancelAlter ( );


DoAlter Method

SQLServer.Operator Object

Description

Commits a unit of Operator property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

Operator.DoAlter

C++

HRESULT pOperator->DoAlter ( );


Refresh Method

SQLServer.Operator Object

Description

Updates Operator properties with current values from SQL Server.

Visual Basic

Operator.Refresh

C++

HRESULT pOperator->Refresh ( );


Remove Method

SQLServer.Operator Object

Description

Drops the SQL Server operator and removes the Operator object.

Visual Basic

Operator.Remove

C++

HRESULT pOperator->Remove ( );

Remarks

You cannot remove an Operator who is the current AlertSystem.FailSafeOperator.

Reference

sp_dropoperator


RemoveNotification Method

SQLServer.Operator Object

Description

Removes an alert from the list of alerts that notify the Operator when the alert fires.

Visual Basic

Operator.RemoveNotification ( [AlertName :=] strAlert )

C++

HRESULT pOperator->RemoveNotification ( SQLOLE_LPCSTR strAlert );

Elements

Element	Type	Description
strAlert	String	Alert to remove
Reference

sp_dropnotification


UpdateNotification Method

SQLServer.Operator Object

Description

Updates the notification method of an alert that is already on the list of alerts that notify this Operator when the alert fires.

Visual Basic

Operator.UpdateNotification (
[AlertName :=] strAlert,
[NotifyMethod :=] tNotify )

C++

HRESULT pOperator->UpdateNotification (
SQLOLE_LPCSTR strAlert,
SQLOLE_NOTIFY_TYPE tNotify );

Elements

Element	Type	Description
strAlert	String	Alert that will notify this Operator when the alert fires
tNotify	SQLOLE_NOTIFY_TYPE	Type of notification to use
Reference

sp_updateoperator, sp_updatenotification


Operator Lists

Operator Object     Properties     Methods     Lists     Collections

EnumNotifications


EnumNotifications List

SQLServer.Operator Object

Description

Lists the alert notifications for this Operator. List is returned in a QueryResults object.

Visual Basic

QueryResults = Operator.EnumNotifications (
[NotifyMethod :=] tNotify,
[AlertsToEnum :=] tAlerts,
[[OperatorName :=] strAlert] )

C++

HRESULT pOperator->EnumNotifications (
SQLOLE_NOTIFY_TYPE tNotify,
SQLOLE_ENUMNOTIFY_TYPE tAlerts,
LPSQLOLEQUERYRESULTS* ppQueryResults,
SQLOLE_LPCSTR strAlert = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
tNotify	SQLOLE_NOTIFY_TYPE	Type of notification to list
tAlerts	SQLOLE_ENUMNOTIFY_TYPE	Which alerts to list
strAlert	String	Specific alert. This parameter is used only when tAlerts is SQLOLEEnumNotify_Target.
QueryResults

ColumnName	ColumnType
operator_id	SQLOLE_DTypeInt4
operator_name	SQLOLE_DTypeChar
use_email	SQLOLE_DTypeInt4
use_pager	SQLOLE_DTypeInt4
has_email	SQLOLE_DTypeBit
has_pager	SQLOLE_DTypeBit
Reference

sp_helpnotification


Operator Collections

Operator Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Registry Object

Registry Object     Properties     Collections

Description

The Registry object contains all of the information stored in the Windows NT Registry for a SQL Server.


Registry Properties

Registry Object     Properties     Collections

Property	Description
Application Application Write: No	The Application object.
AutostartLicensing Boolean Write: Yes	Determines if license logging is started automatically when SQL Server starts. If True, licensing is started automatically when SQL Server starts. If False, licensing must be started manually.
AutostartMail Boolean Write: Yes	Determines if Mail is started when SQL Server starts. If True, Mail is started automatically when SQL Server starts. If False, Mail must be started manually.
AutostartServer Boolean Write: Yes	Determines if SQL Server is started when Windows NT starts. If True, SQL Server is started automatically when Windows NT starts. If False, SQL Server must be started manually.
CaseSensitive Boolean Write: No	Indicates if SQL Server is case-sensitive. If True, SQL Server is using a case-sensitive sort order. If False, SQL Server is using a case-insensitive sort order.
CharacterSet String Write: No	Description of the character set and code page used by SQL Server.
ErrorLogPath String Write: Yes	The full path and file name of the SQL Server error log.
MailAccountName String Write: Yes	The Mail account name.
MailPassword String Write: Yes	The password for the Mail account specified by the MailAccountName property.
MasterDBPath String Write: Yes	The full path and file name of the database device that contains the MASTER database.
NTEventLogging Boolean Write: No	Indicates if Windows NT event logging is enabled. If True, SQL Server sends all events to the Windows NT event log as well as the SQL Server error log. If False, SQL Server sends events only to the SQL Server error log.
NumberOfProcessors Long Write: No	The number of processors on the SQL Server computer.
Parent SQLServer Write: No	The SQLServer object.
PerfMonMode SQLOLE_PERFMON_TYPE Write: Yes	The mode of the performance monitor.
PhysicalMemory Long Write: No	The total physical memory in megabytes on the SQL Server computer.
RegisteredOrganization String Write: No	The name of the organization provided when SQL Server was installed.
RegisteredOwner  String Write: No	The name of the owner provided when SQL Server was installed.
SortOrder  String Write: No	Description of the sort order used by SQL Server.
SQLRootPath  String Write: Yes	The full path where SQL Server was installed.
TapeLoadWaitTime  Long Write: Yes	The number of minutes SQL Server will wait when trying to read a tape that has not been loaded in the drive. A value of −1 means no wait timeout; SQL Server will not sop waiting. A value of 0 means SQL Server will only try once to access a tape in the drive..
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Registry Collections

Registry Object     Properties     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Task Object

Task Object     Properties     Methods     Lists     Collections

Description

A Task object contains information about a scheduled task.


Task Properties

Task Object     Properties     Methods         Lists     Collections

Property	Description
ActiveEndDate Date Write: Yes	The date and time after which this task is active.
ActiveStartDate Date Write: Yes	The date and time before which this task is active.
Application Application Write: No	The Application object.
Command String Write: Yes	The Transact-SQL statement to execute for this task.
Database Identifier Write: Yes	Database to execute this task in.
DateCreated String Write: No	The date and time this task was created.
DateModified String Write: No	The date and time this task was last changed.
Description String Write: Yes	Description of this task.
EmailCompletionLevel SQLOLE_COMPLETION_TYPE  Write: Yes	The task completion status which causes notification of the operator by email.
EmailOperator String Write: Yes	Mail address of operator for notifications.
Enabled Boolean Write: Yes	Determines if this task is active and enabled. If True, this task is active and will be fired when scheduled. If False, the task is disabled and will not be fired.
FrequencyInterval Long Write: Yes	The number of days between daily tasks, the day of the week for weekly tasks, or the day of the month for monthly tasks, on which this task will occur.
FrequencyRecurrenceFactor Long Write: Yes	The number of weeks between weekly tasks, or the number of months between monthly tasks.
FrequencyRelativeInterval SQLOLE_FREQRELATIVE_TYPE  Write: Yes	The day of the month for monthly relative tasks, on which this task will occur.
FrequencySubDay SQLOLE_FREQSUB_TYPE  Write: Yes	Within a specific day, the subday frequency unit of time, by minute or by hour.
FrequencySubDayInterval Long Write: Yes	The number of minutes between minutely tasks, or the number of hours between hourly tasks.
FrequencyType SQLOLE_FREQUENCY_TYPE Write: Yes	The primary frequency unit of time.
ID Long Write: No	The task ID.
LastRunCompletionLevel SQLOLE_COMPLETION_TYPE Write: No	The task completion status of the last execution of this task.
LastRunDate Date Write: No	The date and time this task was last executed.
LastRunDuration Long Write: No	The duration of the last execution of this task. Has the form HHHHMMSS, where HHHH is the number of hours, MM is the number of minutes, and SS is the number of seconds.
LastRunRetries Long Write: No	The number of retry attempts during the previous exection of this task.
LogHistoryCompletionLevel SQLOLE_COMPLETION_TYPE Write: Yes	The task completion status which causes task history information to be logged.
Name Identifier Write: Yes	Task name.
NextRunDate Date Write: No	The date and time this task will next execute.
Owner Identifier Write: No	The user who created this task.
Parent Executive Write: No	The Executive object.
RetryAttempts Long Write: Yes	The number of retries to attempt when a task execution fails.
RetryDelay Long Write: Yes	The delay in minutes between retry attempts.
RunPriority SQLOLE_RUNPRIORITY_TYPE  Write: Yes	The Windows NT thread priority to use when executing this task.
SubSystem String Write: Yes	The subsystem used by a replication task. Can be "Distribution", "LogReader", or "Sync".
TagAdditionalInfo String Write: Yes	Temporary storage space contained in this object used by replication. For Task objects created by the application, this temporary storage space is available for private use by the application. SQL-DMO does not use this property.
TagObjectID Long Write: Yes	Temporary storage space contained in this object used by replication. For Task objects created by the application, this temporary storage space is available for private use by the application. SQL-DMO does not use this property.
TagObjectType Long Write: Yes	Temporary storage space contained in this object used by replication. For Task objects created by the application, this temporary storage space is available for private use by the application. SQL-DMO does not use this property.
TargetSQLServer Identifier Write: Yes	The SQL Server to execute this task on. For use with replication tasks only.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
User Identifer Write: Yes	The database user to use when executing this task.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQLDMO does not use this property.


Task Methods

Task Object     Properties     Methods          Lists     Collections

BeginAlter

CancelAlter

DoAlter

Invoke

PurgeHistory

Reassign

Refresh

Remove


BeginAlter Method

SQLServer.Executive.Task Object

Description

Marks the start of a single unit of changes to Task properties. Normally, each change to a single property is a separate update to SQL Server. To group multiple property changes into a single unit, first call the BeginAlter method, then make the desired property changes. To commit the unit of property changes to SQL Server using a single update, call the DoAlter method. To cancel the unit of property changes (made since calling BeginAlter), call the CancelAlter method.

Visual Basic

Task.BeginAlter

C++

HRESULT pTask->BeginAlter ( );


CancelAlter Method

SQLServer.Executive.Task Object

Description

Cancels a unit of Task property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will not be committed to SQL Server.

Visual Basic

Task.CancelAlter

C++

HRESULT pTask->CancelAlter ( );


DoAlter Method

SQLServer.Executive.Task Object

Description

Commits a unit of Task property changes previously marked with BeginAlter. All property changes made since calling BeginAlter will be committed to SQL Server using a single update.

Visual Basic

Task.DoAlter

C++

HRESULT pTask->DoAlter ( );


Invoke Property
Invoke Method

SQLServer.Executive.Task Object

Description

Executes this task immediately.

Visual Basic

Task.Invoke

C++

HRESULT pTask->Invoke ( );


PurgeHistory Property
PurgeHistory Method

SQLServer.Executive.Task Object

Description

Purges the history for this task. Set the properties of a created HistoryFilter object as desired and pass it to the PurgeHistory method.

Visual Basic

Task.PurgeHistory ( [[HistoryFilter :=] HistoryFilter] )

C++

HRESULT pTask->PurgeHistory ( LPSQLOLEHISTORYFILTER HistoryFilter = NULL );

Elements

Element	Type	Description
HistoryFilter	HistoryFilter	HistoryFilter object
Reference

sp_purgehistory


Reassign Method

SQLServer.Executive.Task Object

Description

Assigns ownership of this Task to a new login.

Visual Basic

Task.Reassign ( [NewLogin :=] idLogin )

C++

HRESULT pTask->Reassign ( SQLOLE_LPCSTR idLogin );

Elements

Element	Type	Description
idLogin	Identifier	Login


Refresh Method

SQLServer.Executive.Task Object

Description

Updates Task properties with current values from SQL Server.

Visual Basic

Task.Refresh

C++

HRESULT pTask->Refresh ( );


Remove Property
Remove Method

SQLServer.Executive.Task Object

Description

Drops the SQL Server task and removes the Task object.

Visual Basic

Task.Remove

C++

HRESULT pTask->Remove ( );

Reference

sp_droptask


Task Lists

Task Object     Properties     Methods          Lists     Collections

EnumHistory


EnumHistory List

SQLServer.Executive.Task Object

Description

Lists the event history for this task. List is returned in a QueryResults object. Set the properties of a created HistoryFilter object as desired and pass it to the EnumHistory method.

Visual Basic

QueryResults = Task.EnumHistory ( [[HistoryFilter :=] HistoryFilter] )

C++

HRESULT pTask->EnumHistory (
LPSQLOLEQUERYRESULTS* ppQueryResults,
LPSQLOLEHISTORYFILTER HistoryFilter = NULL );

Elements

Element	Type	Description
QueryResults	QueryResults	Returned QueryResults object
HistoryFilter	HistoryFilter	HistoryFilter object
QueryResults

ColumnName	ColumnType
id	SQLOLE_DTypeInt4
eventid	SQLOLE_DTypeInt4
messageid	SQLOLE_DTypeInt4
severity	SQLOLE_DTypeInt4
taskname	SQLOLE_DTypeChar
source	SQLOLE_DTypeChar
category	SQLOLE_DTypeChar
runstatus	SQLOLE_DTypeInt4
rundate	SQLOLE_DTypeInt4
runtime	SQLOLE_DTypeInt4
runduration	SQLOLE_DTypeInt4
reviewstatus	SQLOLE_DTypeChar
emailoperatorname	SQLOLE_DTypeChar
retries	SQLOLE_DTypeInt4
comments	SQLOLE_DTypeChar
timesskipped	SQLOLE_DTypeInt4
Reference

sp_helphistory


Task Collections

Task Object     Properties     Methods     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Chapter 7   Application Scope Objects
Application Scope Objects

Application Object

Backup Object

HistoryFilter Object

Names Object

Permission Object

Property Object

QueryResults Object


Application Object

Application Object     Properties     Methods     Collections

Description

The Application object is a standard OLE object which provides common properties and methods for managing the application environment. Each SQL-DMO application has a single Application object.


Application Object Properties
Application Properties

Application Object     Properties     Methods     Collections

Property	Description
Application Application Write: No	The Application object.
DBLibraryVersionString String Write: No	The DB-Library version string.
FullName String Write: No	The full path and filename of the SQL-DMO component object layer.
Name String Write: No	The name of the SQL-DMO component object layer.
Parent Application Write: No	The Application object.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.
VersionMajor Long Write: No	The SQL-DMO component object layer version number to the left of the decimal point.
VersionMinor Long Write: No	The SQL-DMO component object layer version number to the right of the decimal point.


Application Object Methods
Application Methods

Application Object     Properties     Methods     Collections

Quit


Quit Method

Application Object

Description

Closes all connections used by SQLServer objects in the Application.SQLServers collection, and releases all existing SQLDMO objects. This invalidates all object variables that refer to SQLDMO objects. You cannot use or reference any SQLDMO objects created before you called the Quit method. To continue using SQLDMO objects after calling this method, you must create new SQLDMO objects.

Visual Basic

Application.Quit

C++

HRESULT pApplication->Quit ( );


Application Collections

Application Object     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.
SQLServers SQLServers Write: No	The collection of SQLServer objects.


Backup Object

Backup Object     Properties     Collections

Description

A Backup object contains complete information used to perform a backup or restore of a Database or TransactionLog. First create a new Backup object, then set the properties to the appropriate values, and then pass the Backup object to the Dump, Load, or GenerateBackupSQL method of the Database or TransactionLog object, or the SQLServer.ReadBackupHeader method.


Backup Properties

Backup Object     Properties     Collections

Property	Description
Application Application Write: No	The Application object.
DiskDevices MultiString Write: Yes	Delimited list of hard disk device and volume specifiers. Each specifier consists of the full path and file name of the hard disk device, an equal sign, and an optional volume name.
DumpDevices MultiString Write: Yes	Delimited list of dump device and volume specifiers. Each specifier consists of the dump device name, an equal sign, and an optional volume name.
DumpExpirationDate String Write: String	The date and time when the disk or tape device expires. Any attempt to overwrite a dump before this date will fail.
DumpInitDeviceBefore Boolean Write: Yes	Determines if the disk or tape device is initialized before a dump is performed. If True, the dump starts at the beginning of the device, and any existing data on the device is overwritten. If False, the dump is appended to the end of the device. The default is False.
DumpRetainDays Long Write: Yes	The number of days after a dump has been performed to retain that dump. Any attempt to overwrite a dump before this number of days has elapsed will fail.
FloppyDevices MultiString Write: Yes	Delimited list of floppy disk device and volume specifiers. Each specifier consists of the full path and file name of the floppy disk device, an equal sign, and an optional volume name.
LoadFileNumber Long Write: Yes	The file to load from a tape or disk device.
LoadTableBatchPages Long Write: Yes	The number of data pages to load between transaction commits during the load of a single table. The default is 0.
Parent Application Write: No	The Application object.
SkipTapeHeader Boolean Write: Yes	Determines if the ANSI headers are skipped when dumping to or loading from a tape device. If True, ANSI tape headers are skipped. If False, ANSI tape headers are read. The default is False.
TapeDevices MultiString Write: Yes	Delimited list of tape device and volume specifiers. Each specifier consists of the full path and file name of the tape device, an equal sign, and an optional volume name.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UnloadTapeAfter Boolean Write: Yes	Determines if a tape is automatically rewound and unloaded when a dump or load completes. If True, the tape is automatically rewound and unloaded. If False, the tape is left alone. The default is False.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Backup Collections

Backup Object     Properties     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


HistoryFilter Object

HistoryFilter Object     Properties     Collections

Description

The HistoryFilter object is used to qualify task history rows to list or purge. First create a new HistoryFilter object, then set the properties to the appropriate values, and then pass the HistoryFilter object to the EnumHistory or PurgeHistory method of the SQLServer or Task object.


HistoryFilter Properties

HistoryFilter Object     Properties     Collections

Property	Description
Application Application Write: No	The Application object.
CategoryName String Write: Yes	The event category name to include.
CompletionTypes SQLOLE_COMPLETION_TYPE  Write: Yes	The types of task completions to include.
EndDate Date Write: Yes	The date and time before which to include tasks.
EventID Long Write: Yes	The event ID to include.
EventTypes SQLOLE_EVENT_TYPE  Write: Yes	The types of task events to include.
MessageID Long Write: Yes	The message ID to include.
MinimumRetries Long Write: Yes	The minimum number of retry attempts made for a task.
MinimumRunDuration Date Write: Yes	The minimum length of time a task took to complete.
MinimumTimesSkipped Long Write: Yes	The minimum number of times a task was skipped.
OldestFirst Boolean Write: Yes	Determines if the list is sorted by the ascending time of task occurrence. If True, the oldest task is listed first. If False, the newest task is listed first.
Parent Application Write: No	The Application object.
Severity Long Write: Yes	The severity to include.
Source String Write: Yes	The event source to include.
StartDate Date Write: Yes	The date and time after which to include tasks.
TaskID Long Write: Yes	The task ID to include. If you are not the system administrator and you are passing this to SQLServer.PurgeHistory, you must specify a task and you must be its owner.
TaskName Identifier Write: Yes	The name of the task to include. If you are not the system administrator and you are passing this to SQLServer.PurgeHistory, you must specify a task and you must be its owner.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQLDMO does not use this property.


HistoryFilter Collections

HistoryFilter Object     Properties     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Names Object

Names Object     Properties     Methods

Description

A Names collection contains strings instead of objects.


Names Properties

Names Object     Properties     Methods

Property	Description
Application Application Write: No	The Application object.
Parent Object Write: No	The Object object, where Object is the parent object.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Names Methods

Names Object     Properties     Methods

The Names collection has the following standard SQL-DMO collection methods that operate on strings instead of objects:

Visual Basic	C++
Add	Add
Remove	RemoveByName, RemoveByOrd
Refresh	Refresh
The Names collection has the following additional methods:

FindName

Insert

Replace


FindName Method

Names Object

Description

Returns the ordinal value of a string in the Names collection.

Visual Basic

lOrdinal = Names.FindName ( [Name :=] strName )

C++

HRESULT pNames->FindName (
SQLOLE_LPCSTR szName,
LPLONG plOrdinal );

Elements

Element	Type	Description
lOrdinal	Long	Returned ordinal value into the collection. For Visual Basic the first ordinal value is number 1. For C++ the first ordinal value is 0.
strName	String	String to find.


Insert Method

Names Object

Description

Inserts a new string into the Names collection.

Visual Basic

Names.Insert (
[NewName :=] strName,
[InsertBeforeItem :=] {strBeforeName | lBeforeOrdinal} )

C++

HRESULT pNames->InsertByName (
SQLOLE_LPCSTR strName,
SQLOLE_LPCSTR strBeforeName );

HRESULT pNames->InsertByOrd (
SQLOLE_LPCSTR strName,
long lBeforeOrdinal );

Elements

Element	Type	Description
strName	String	New string to insert into Names collection.
strBeforeName	String	Name before which the new string is inserted. If empty, the new string is added as the last string in the Names collection.
lBeforeOrdinal	Long	Ordinal value into the collection of the Name before which the new Name is inserted. For Visual Basic the first ordinal value is number 1. If 0 is specified, the new string is added as the last string in the Names collection. For C++ the first ordinal value is 0. If −1 is specified, the new string is added as the last string in the Names collection.
Remarks

For the Configuration.Parameters Names collection, new strings are always inserted as the last string in the collection.


Replace Method

Names Object

Description

Replaces an existing string in the Names collection.

Visual Basic

Names.Replace (
[NewName :=] strName,
[ReplaceItem :=] {strReplaceName | lReplaceOrdinal} )

C++

HRESULT pNames->ReplaceByName (
SQLOLE_LPCSTR strName,
SQLOLE_LPCSTR strReplaceName );

HRESULT pNames->ReplaceByOrd (
SQLOLE_LPCSTR strName,
long lReplaceOrdinal );

Elements

Element	Type	Description
strName	String	New string to insert into Names collection.
strReplaceName	String	String to replace.
lReplaceOrdinal	Long	Index into the Names collection of the Name  to replace. For Visual Basic the first ordinal value is number 1. For C++ the first ordinal value is 0.


Permission Object

Permission Object     Properties     Lists     Collections

Description

A Permission object contains information about a database user's object or statement privileges. It is returned by various ListItemPermissions methods of various objects.


Permission Properties

Permission Object     Properties    Lists     Collections

Property	Description
Application Application Write: No	The Application object.
Granted Boolean Write: No	Indicates if the privilege was granted. If True, this privilege is granted. If False, the privilege is revoked.
Grantee Identifier Write: No	The database user or group this privilege applies to.
ObjectID Long Write: No	The object ID this privilege applies to.
ObjectName Identifier Write: No	The object name this privilege applies to.
ObjectOwner Identifier Write: No	The database user that owns the object this privilege applies to.
ObjectType SQLOLE_OBJECT_TYPE  Write: No	The type of the object this privilege applies to.
ObjectTypeName String Write: No	The name of the type of the object this privilege applies to.
Parent Application Write: No	The Application object.
PrivilegeType SQLOLE_PRIVILEGE_TYPE  Write: No	The type of privilege.
PrivilegeTypeName String Write: No	The name of the privilege type.
TypeOf SQLOLE_OBJECT_TYPE  Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


Permission Lists

Permission Object     Properties     Lists     Collections

ListPrivilegeColumns


ListPrivilegeColumns List

Permission Object

Description

Returns a list of Column objects included in SELECT or UPDATE privileges for a table or view, if this Privilege object is of that type.

Visual Basic

ColumnList = Permission.ListPrivilegeColumns

C++

HRESULT pPermission->ListPrivilegeColumns ( LPSQLOLECOLUMNLIST* ppColumnList );

Elements

Element	Type	Description
ColumnList	ColumnList	Returned list of Column objects


Permission Collections

Permission Object     Properties     Lists     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Property Object

Property Object     Properties     Collections

Description

A Property object contains information about a property of a SQL-DMO object. Each SQL-DMO object (not including collections) has a Properties collection that contains one Property object for each property (not including object properties or indexed properties) of the SQL-DMO object.

The Property object and the Properties collections are only available to Visual Basic programs and other OLE Automation controllers. They are not available to C++ programs.


Property Properties

Property Object     Properties     Collections

Property	Description
Application Application Write: No	The Application object.
Get Boolean Write: No	Indicates if this property can ever be read. If True, this property value can be read, but it might not be readable now. If False, this property value can never be read.
Name String Write: No	The name of the property.
Parent Object Write: No	The Object object, where Object is the parent object.
Set Boolean Write: No	Indicates if this property can ever be changed. If True, this property value can be changed, but it might not be changeable now. If False, this property value can never be changed.
Type Long Write: No	The Visual Basic type of the property.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.
Value Datatype Write: Yes	The current property value, where Datatype is the datatype of the property.


Property Collections

Property Object     Properties     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


QueryResults Object

QueryResults Object     Properties     Methods     Collections

Description

A QueryResults object contains the result set from an executed Transact-SQL query. All EnumItems list methods return a QueryResults object. The ExecuteWithResults method of the SQLServer, Database, and RemoteServer objects also returns a QueryResults object. The query results returned from SQL Server are stored in memory and cannot be changed.

To retrieve data from a specific result set, set the CurrentResultSet property to the desired result set. Then call the desired GetColumnDatatype method to get a value from a single column of a single row, or call the GetRangeString method to return a block of row and column data.


QueryResults Properties

QueryResults Object     Properties     Methods     Collections

Property	Description
Application Application Write: No	The Application object.
Columns Long Write: No	The number of columns in the current result set.
CurrentResultSet Long Write: Yes	The current result set. The first result set is number 1. Set this property to change the current result set.
Parent Application Write: No	The Application object.
ResultSets Long Write: No	The number of result sets.
Rows Long Write: No	The number of rows in the current result set.
TypeOf SQLOLE_OBJECT_TYPE Write: No	The type of object.
UserData Long Write: Yes	Temporary storage space contained in this object for private use by the application. SQL-DMO does not use this property.


QueryResults Methods

QueryResults Object     Properties     Methods     Collections

ColumnMaxLength

ColumnName

ColumnType

GetColumnBool

GetColumnDouble

GetColumnFloat

GetColumnLong

GetColumnString

GetRangeString

Refresh


ColumnMaxLength Method

QueryResults Object

Description

Returns the maximum length of a column in the current result set.

Visual Basic

lMaxLength = QueryResults.ColumnMaxLength ( [Column :=] lColumn )

C++

HRESULT pQueryResults->GetColumnMaxLength (
long lColumn,
LPLONG plMaxLength );

Elements

Element	Type	Description
lMaxLength	Long	Returned maximum column length
plColumn	Long	Column number of the current result set
Remarks

This is an indexed property.


ColumnName Method

QueryResults Object

Description

Returns the name of a column in the current result set.

Visual Basic

strName = QueryResults.ColumnName ( [Column :=] lColumn )

C++

HRESULT pQueryResults->GetColumnName (
long lColumn,
SQLOLE_LPBSTR strName );

Elements

Element	Type	Description
strName	String	Returned column name
lColumn	Long	Column number of the current result set
Remarks

This is an indexed property.


ColumnType Method

QueryResults Object

Description

Returns the datatype of a column in the current result set.

Visual Basic

tDatatype = QueryResults.ColumnType ( [Column :=] lColumn )

C++

HRESULT pQueryResults->GetColumnType (
long lColumn,
SQLOLE_QUERY_DATATYPE* tDatatype );

Elements

Element	Type	Description
tDatatype	QueryDatatype	Returned column datatype
lColumn	Long	Column number of the current result set
Remarks

This is an indexed property.


GetColumnBool Method

QueryResults Object

Description

Returns the data, converted to a boolean value, in a column of a row in the current result set.

Visual Basic

bColumnData = QueryResults.GetColumnBool (
[Row :=] lRow,
[Column :=] lColumn )

C++

HRESULT pQueryResults->GetColumnBool (
long lRow,
long lColumn,
LPBOOL pbColumnData );

Elements

Element	Type	Description
bColumnData	Boolean	Returned column data
lRow	Long	Row number of the current result set
lColumn	Long	Column number of the specified row


GetColumnDouble Method

QueryResults Object

Description

Returns the data, converted to a double value, in a column of a row in the current result set.

Visual Basic

dColumnData = QueryResults.GetColumnDouble (
[Row :=] lRow,
[Column :=] lColumn )

C++

HRESULT pQueryResults->GetColumnDouble (
long lRow,
long lColumn,
LPDOUBLE pdColumnData );

Elements

Element	Type	Description
dColumnData	Double	Returned column data
lRow	Long	Row number of the current result set
lColumn	Long	Column number of the specified row


GetColumnFloat Method

QueryResults Object

Description

Returns the data, converted to a float value, in a column of a row in the current result set.

Visual Basic

fColumnData = QueryResults.GetColumnFloat (
[Row :=] lRow,
[Column :=] lColumn )

C++

HRESULT pQueryResults->GetColumnFloat (
long lRow,
long lColumn,
LPFLOAT pfColumnData );

Elements

Element	Type	Description
fColumnData	Float	Returned column data
lRow	Long	Row number of the current result set
lColumn	Long	Column number of the specified row


GetColumnLong Method

QueryResults Object

Description

Returns the data, converted to a long value, in a column of a row in the current result set.

Visual Basic

lColumnData = QueryResults.GetColumnLong (
[Row :=] lRow,
[Column :=] lColumn )

C++

HRESULT pQueryResults->GetColumnLong (
long lRow,
long lColumn,
LPLONG plColumnData );

Elements

Element	Type	Description
lColumnData	Long	Returned column data
lRow	Long	Row number of the current result set
lColumn	Long	Column number of the specified row


GetColumnString Method

QueryResults Object

Description

Returns the data, converted to a string value, in a column of a row in the current result set.

Visual Basic

strColumnData = QueryResults.GetColumnString (
[Row :=] lRow,
[Column :=] lColumn )

C++

HRESULT pQueryResults->GetColumnString (
long lRow,
long lColumn,
SQLOLE_LPBSTR pstrColumnData );

Elements

Element	Type	Description
strColumnData	String	Returned column data
lRow	Long	Row number of the current result set
lColumn	Long	Column number of the specified row


GetRangeString Method

QueryResults Object

Description

Returns a single string containing a block of rows and columns from the current result set.

Visual Basic

strOutput = QueryResults->GetRangeString (
[[Top :=] lTop,]
[[Left :=] lLeft,]
[[Bottom :=] lBottom,]
[[Right :=] lRight,]
[[RowDelim :=] strRowDelimiter,]
[[ColDelim :=] strColumnDelimiter,]
[[ColWidths :=] mstrColumnWidthList] )

C++

HRESULT pQueryResults->GetRangeString (
SQLOLE_LPBSTR pstrOutput,
long lTop = 0,
long lLeft = 1,
long lBottom = -1,
long lRight = -1,
SQLOLE_LPCSTR strRowDelimiter = NULL,
SQLOLE_LPCSTR strColumnDelimiter = NULL,
SQLOLE_LPCSTR mstrColumnWidthList = NULL );

Elements

Element	Type	Description
strOutput	String	Returned block of rows and columns from the current result set.
lTop	Long	First row to return.
lLeft	Long	First column to return.
lBottom	Long	Last row to return.
lRight	Long	Last column to return.
strRowDelimiter	String	String placed between each row. The default is the newline string.
strColumnDelimiter	String	String placed between each column. The default is the tap character.
mstrColumnWidthList	MultiString	Delimited list of column width values. For a given column, data shorter than the specified width will be padded with spaces to fill the entire width, and data longer than the specified width will be truncated to the width. If the number of width values is greater than the number of columns requested, the extra width values are ignored. If the number of width values is less than the number of columns requested, the default width values will be used for the last columns.


Refresh Method

QueryResults Object

Description

Updates QueryResults data with current values from SQL Server by reexecuting the Transact-SQL query.

Visual Basic

QueryResults.Refresh

C++

HRESULT pQueryResults->Refresh ( );


QueryResults Collections

QueryResults Object     Properties     Methods     Collections

Collection	Description
Properties Properties Write: No	The collection of Property objects.


Enumerated Datatypes

SQLOLE_AUDIT_TYPE

SQLOLE_COMPLETION_TYPE

SQLOLE_CONFIGVALUE_TYPE

SQLOLE_COPYDATA_TYPE

SQLOLE_DATAFILE_TYPE

SQLOLE_DBSTATUS_TYPE

SQLOLE_DBUSERPROFILE_TYPE

SQLOLE_DEPENDENCY_TYPE

SQLOLE_DEVICE_TYPE

SQLOLE_ENUMNOTIFY_TYPE

SQLOLE_ERROR_TYPE

SQLOLE_EVENT_TYPE

SQLOLE_EXEC_TYPE

SQLOLE_FREQRELATIVE_TYPE

SQLOLE_FREQSUB_TYPE

SQLOLE_FREQUENCY_TYPE

SQLOLE_INDEX_TYPE

SQLOLE_INITIALSYNC_TYPE

SQLOLE_INTSECLOGIN_TYPE

SQLOLE_KEY_TYPE

SQLOLE_MEDIA_TYPE

SQLOLE_MIRROR_TYPE

SQLOLE_MONTHDAY_TYPE

SQLOLE_NOTIFY_TYPE

SQLOLE_OBJECT_TYPE

SQLOLE_OBJSORT_TYPE

SQLOLE_PERFMON_TYPE

SQLOLE_PREARTICLE_TYPE

SQLOLE_PRIVILEGE_TYPE

SQLOLE_PROCEDURE_TYPE

SQLOLE_QUERY_DATATYPE

SQLOLE_REPFREQ_TYPE

SQLOLE_REPLICATION_TYPE

SQLOLE_RUNPRIORITY_TYPE

SQLOLE_SCRIPT_TYPE

SQLOLE_SECURITY_TYPE

SQLOLE_SRVOPTION_TYPE

SQLOLE_SRVUSERPROFILE_TYPE

SQLOLE_STARTSRV_TYPE

SQLOLE_STATUSINFO_TYPE

SQLOLE_SUBSTATUS_TYPE

SQLOLE_SUBSYNC_TYPE

SQLOLE_SVCSTATUS_TYPE

SQLOLE_TABLEATT_TYPE

SQLOLE_TRIGGER_TYPE

SQLOLE_VERIFYCONN_TYPE

SQLOLE_WEEKDAY_TYPE


SQLOLE_AUDIT_TYPE

Values

SQLOLEAudit_None

SQLOLEAudit_Success

SQLOLEAudit_Failure

SQLOLEAudit_All


SQLOLE_COMPLETION_TYPE

Values

SQLOLEComp_Unknown

SQLOLEComp_None

SQLOLEComp_Success

SQLOLEComp_Failure

SQLOLEComp_Always

SQLOLEComp_Running

SQLOLEComp_Aborted

SQLOLEComp_Skipped

SQLOLEComp_All


SQLOLE_CONFIGVALUE_TYPE

Values

SQLOLEConfig_RecoveryInterval

SQLOLEConfig_AllowUpdates

SQLOLEConfig_UserConnections

SQLOLEConfig_Memory

SQLOLEConfig_OpenDatabases

SQLOLEConfig_Locks

SQLOLEConfig_OpenObjects

SQLOLEConfig_ProcedureCache

SQLOLEConfig_FillFactor

SQLOLEConfig_DatabaseSize

SQLOLEConfig_MediaRetention

SQLOLEConfig_RecoveryFlags

SQLOLEConfig_NestedTriggers

SQLOLEConfig_RemoteAccess

SQLOLEConfig_DefaultLanguage

SQLOLEConfig_LanguageInCache

SQLOLEConfig_TempdbInRamMB

SQLOLEConfig_MaxAsyncIO

SQLOLEConfig_MaxWorkerThreads

SQLOLEConfig_NetworkPacketSize

SQLOLEConfig_RAWorkerThreads

SQLOLEConfig_ShowAdvancedOption

SQLOLEConfig_LEThresholdPercent

SQLOLEConfig_LEThresholdMaximum

SQLOLEConfig_BackupThreads

SQLOLEConfig_BackupBufferSize

SQLOLEConfig_TimeSlice

SQLOLEConfig_RemoteSites

SQLOLEConfig_DefaultSortorderId

SQLOLEConfig_HashBuckets

SQLOLEConfig_SortPages

SQLOLEConfig_MaxLazywriteIO

SQLOLEConfig_RASlotsPerThread

SQLOLEConfig_RAPrefetches

SQLOLEConfig_RADelay

SQLOLEConfig_RACacheMissLimit

SQLOLEConfig_RACacheHitLimit

SQLOLEConfig_SpinCounter

SQLOLEConfig_FreeBuffers

SQLOLEConfig_SMPConcurrency

SQLOLEConfig_PriorityBoost

SQLOLEConfig_RemoteLoginTimeout

SQLOLEConfig_RemoteQueryTimeout

SQLOLEConfig_LEThresholdMinimum

SQLOLEConfig_LogwriteSleepMS

SQLOLEConfig_SetWorkingSetSize


SQLOLE_COPYDATA_TYPE

Values

SQLOLECopyData_False

SQLOLECopyData_Replace

SQLOLECopyData_Append


SQLOLE_DATAFILE_TYPE

Values

SQLOLEDataFile_Default

SQLOLEDataFile_CommaDelimitedChar

SQLOLEDataFile_TabDelimitedChar

SQLOLEDataFile_SpecialDelimitedChar

SQLOLEDataFile_NativeFormat


SQLOLE_DBSTATUS_TYPE

Values

SQLOLEDBStat_Normal

SQLOLEDBStat_Loading

SQLOLEDBStat_Recovering

SQLOLEDBStat_Suspect

SQLOLEDBStat_Offline

SQLOLEDBStat_Inaccessible

SQLOLEDBStat_EmergencyMode

SQLOLEDBStat_All


SQLOLE_DBUSERPROFILE_TYPE

Values

SQLOLEDbUserProf_None

SQLOLEDbUserProf_DboLogin

SQLOLEDbUserProf_CreateTable

SQLOLEDbUserProf_CreateView

SQLOLEDbUserProf_CreateProcedure

SQLOLEDbUserProf_DumpDatabase

SQLOLEDbUserProf_CreateDefault

SQLOLEDbUserProf_DumpTransaction

SQLOLEDbUserProf_CreateRule

SQLOLEDbUserProf_AllProfileBits

SQLOLEDbUserProf_InvalidLogin

SQLOLEDbUserProf_InaccessibleDb

SQLOLEDbUserProf_DbNotAvailable


SQLOLE_DEPENDENCY_TYPE

Values

SQLOLEDep_Parents

SQLOLEDep_FullHierarchy

SQLOLEDep_OrderDescending

SQLOLEDep_Children

SQLOLEDep_ReturnInputObject

SQLOLEDep_FirstLevelOnly

SQLOLEDep_DRIOnly

SQLOLEDep_Valid


SQLOLE_DEVICE_TYPE

Values

SQLOLEDevice_Unknown

SQLOLEDevice_Database

SQLOLEDevice_DiskDump

SQLOLEDevice_FloppyADump

SQLOLEDevice_FloppyBDump

SQLOLEDevice_TapeDump

SQLOLEDevice_Reserved

SQLOLEDevice_CDROM


SQLOLE_ENUMNOTIFY_TYPE

Values

SQLOLEEnumNotify_Min

SQLOLEEnumNotify_All

SQLOLEEnumNotify_Actual

SQLOLEEnumNotify_Target

SQLOLEEnumNotify_Max


SQLOLE_ERROR_TYPE

Values

SQLOLE_E_DBLIBFIRSTERROR
SQLOLE_E_DBLIBLASTERROR
SQLOLE_E_FIRSTERROR
SQLOLE_ECAT_MASK
SQLOLE_ECAT_ INVALIDCONTEXT
SQLOLE_E_ALREADYCONN	This server object is already connected.
SQLOLE_E_ALREADYCOLL	This object is already in a collection.
SQLOLE_E_NOTCONN	This server object is not connected.
SQLOLE_E_CANTDROPSERVER	You cannot drop a server.  Use Server.Close when the object is no longer needed.
SQLOLE_E_NOCOMPLEXALTER	Modifying or removing existing table columns, or inserting new ones prior to end of table, is not supported.
SQLOLE_E_PROPNEEDSCREATE	This property or method is not available until the object (or its parent if appropriate) has been added to a collection.
SQLOLE_E_COLTYPEFIXED	Column type '%s' is fixed length; no length may be specified.
SQLOLE_E_COLTYPENONNULL	Column type '%s' may not be specified to allow NULL values.
SQLOLE_E_CANTCHANGEUDDT	Cannot change the base type, length, or nullability of an existing User-defined datatype.
SQLOLE_E_BASETYPEFIXED	Base datatype '%s' is fixed length; no length may be specified.
SQLOLE_E_BASETYPENONNULL	Base datatype '%s' may not be specified to allow NULL values.
SQLOLE_E_ENUMORDINAL	This is an enumeration-only list object and must be indexed by ordinal.
SQLOLE_E_CANTRENAMEUSER	Existing User's User name and Login name cannot be changed.
SQLOLE_E_ CANTRENAMEGROUP	Existing Group name cannot be changed.
SQLOLE_E_ CANTRENAMELOGIN	Existing Login's name cannot be changed.
SQLOLE_E_ CANTRENAMEDEVICE	Existing Device's name, type, size, physical location, or label skipping cannot be changed.
SQLOLE_E_NOTDUMPPROP	This property or method cannot be used with a dump device.
SQLOLE_E_NOSERVERASSOC	No server has been associated with this object.
SQLOLE_E_NOTCOLLTYPE	This object type does not match the collection's type.  It cannot be added.
SQLOLE_E_ CANTMODIFYDRIINDEX	This index was generated by a DRI 'PRIMARY KEY' or 'UNIQUE KEY' CONSTRAINT and cannot be modified or dropped.
SQLOLE_E_ CANTCHANGEPROCTYPE	Existing StoredProcedure type cannot be changed.
SQLOLE_E_ CANTMODIFYINDEX	This property or method cannot be set or invoked after the index has been created.
SQLOLE_E_INVALIDPRIVOBJ	This object type cannot have granted privileges.
SQLOLE_E_ CANTCHANGETRIGTYPE	Existing trigger type cannot be changed.
SQLOLE_E_NOVIEWCOLALTER	Columns of a view cannot be modified.  The base corresponding base table's column must be used.
SQLOLE_E_ CANTRENAMELANGUAGE	Existing language's name, months, short months, days, dateformat, and first day of week cannot be changed.
SQLOLE_E_ CANTRENAMERSERVER	Existing Remote Server's name cannot be changed.
SQLOLE_E_ CANTRENAMERLOGIN	Existing Remote Login's local name and remote name cannot be changed.
SQLOLE_E_MUSTBEDBDEV	This method or property can only be used with a database device.
SQLOLE_E_ NOINACTIVEMIRROR	This device has no inactive mirror.
SQLOLE_E_NOACTIVEMIRROR	This device has no active mirror.
SQLOLE_E_NOMIRROR	This device has no active or inactive mirror.
SQLOLE_E_ SERVERDISCONNECTED	This server has been DisConnected.  You must ReConnect to perform this operation.
SQLOLE_E_ CANTRENAMESERVER	You cannot change the name, login, password, login timeout, login security, or network packet size for a server object while it is connected.
SQLOLE_E_CANTMODIFYTEXT	Modifying the text of an existing Rule, Default, Stored Procedure, View, or Trigger is not allowed. You must drop and recreate the object.
SQLOLE_E_ CANTMODIFYSYSTABLE	System tables cannot be altered, dropped, or otherwise modified.
SQLOLE_E_ LOGINALREADYALIASED	The Login '%s' is already aliased to user '%s' in this database.
SQLOLE_E_ LOGINALREADYUSER	The Login '%s' is already assigned to user '%s' in this database.
SQLOLE_E_CACHENORESULTS	This cache contains no result sets, or the current result set contains no rows.
SQLOLE_E_ALREADYCREATED	This object has already been created.
SQLOLE_E_NOTDISCONN	This server is already Connected.
SQLOLE_E_ CANTMODIFYARTTABLE	You cannot change the Source Table of an existing Article.
SQLOLE_E_ CANTMODIFYSUBSERVER	You cannot change the Subscribing Server of an existing Subscription.
SQLOLE_E_ BASETYPENOTNUMERIC	Base datatype '%s' is not a numeric type; no precision or scale may be specified.
SQLOLE_E_ TOFILEBUTNOFILENAME	ScriptMode specified as ToFileOnly, but no filename specified -- recheck parameters.
SQLOLE_E_ MUSTBEDISTSERVER	The distribution server is either undefined or not the current server, so the Distribution Working Directory cannot be set.
SQLOLE_E_CANTMODIFYKEY	You cannot modify an existing Key's Clustered, FillFactor, or ReferencedTable properties.
SQLOLE_E_LISTCANTREFRESH	This object list cannot be refreshed; you must Release it and re-invoke the method which returned it.
SQLOLE_E_NOCOLTABLE	This column object is not associated with a table.
SQLOLE_E_MUSTBEINALTER	Modifying this property can only be done when the table is in Alter mode (BeginAlter has been called).
SQLOLE_E_ CANTUNDEDICATELOGDEVICE	Cannot undedicate a dedicated log device in this version of SQL Server.
SQLOLE_ECAT_ INVALIDOBJECT
SQLOLE_E_OBJECTDROPPED	This object has been dropped from the server.
SQLOLE_E_NOTSQLOLEOBJECT	The passed object is not a SQLOLE object.
SQLOLE_E_OBJECTDETACHED	This object has been detached from SQLOLE, as the result of a refresh, automatic shutdown, error, or App.Quit.
SQLOLE_E_SERVERCLOSED	This server object has been Closed.  It can no longer be used.
SQLOLE_ECAT_ INVALIDOBJECTDEFINITION
SQLOLE_E_ NOCOLUMNSADDED	No new columns or constraints have been added to this table object
SQLOLE_E_ COLUMNINCOMPLETE	Column definition must include name, datatype, length if appropriate to datatype, and null specification if adding to an existing table.
SQLOLE_E_TABLEINCOMPLETE	Table name not specified.
SQLOLE_E_UDDTINCOMPLETE	Datatype definition must include name, base datatype, and length if appropriate to base datatype.
SQLOLE_E_RULEINCOMPLETE	Rule definition must include name and text of rule.
SQLOLE_E_ DEFAULTINCOMPLETE	Default definition must include name and text of default.
SQLOLE_E_VIEWINCOMPLETE	View definition must include name and text of view.
SQLOLE_E_USERINCOMPLETE	User's Login name not specified.
SQLOLE_E_GROUPINCOMPLETE	Group name not specified.
SQLOLE_E_PROCINCOMPLETE	Stored procedure definition must include name and text (for Standard StoredProcedure) or libraryname (for Extended StoredProcedure).
SQLOLE_E_ USERALREADYEXISTS	User '%s' already exists.
SQLOLE_E_ GROUPALREADYEXISTS	Group '%s' already exists.
SQLOLE_E_ COLUMNALREADYEXISTS	Column '%s' already exists.
SQLOLE_E_ OBJECTALREADYEXISTS	User '%s' already owns an object named '%s' in this database.
SQLOLE_E_ INDEXALREADYEXISTS	Index '%s' on table '%s' already exists.
SQLOLE_E_DBALREADYEXISTS	Database '%s' already exists.
SQLOLE_E_ LOGINALREADYEXISTS	Login '%s' already exists.
SQLOLE_E_ DEVICEALREADYEXISTS	Device '%s' already exists.
SQLOLE_E_SKIPONLYTAPE	Skip option is only valid for tape dump devices.
SQLOLE_E_ DEVICEINCOMPLETE	Device definition must include logical name, physical name, device type, and size if defining a database device.
SQLOLE_E_ PROCALREADYEXISTS	StoredProcedure '%s' already exists.
SQLOLE_E_ UDDTALREADYEXISTS	UserDefinedDatatype '%s' already exists.
SQLOLE_E_ TABLEALREADYEXISTS	Table '%s' already exists.
SQLOLE_E_ RULEALREADYEXISTS	Rule '%s' already exists.
SQLOLE_E_ DEFAULTALREADYEXISTS	Default '%s' already exists.
SQLOLE_E_ VIEWALREADYEXISTS	View '%s' already exists.
SQLOLE_E_INDEXINCOMPLETE	Index definition must include a name and at least one column to index.
SQLOLE_E_TRIGINCOMPLETE	Trigger definition must include name and text.
SQLOLE_E_ TRIGALREADYEXISTS	Trigger '%s' on table '%s' already exists.
SQLOLE_E_ LANGUAGEINCOMPLETE	Language definition must include name, months, shortmonths, and days.
SQLOLE_E_ LANGUAGEALREADYEXISTS	Language '%s' already exists.
SQLOLE_E_LOGININCOMPLETE	Login name not specified.
SQLOLE_E_ RSERVERINCOMPLETE	Remote Server name not specified.
SQLOLE_E_ RSERVERALREADYEXISTS	Remote Server '%s' already exists.
SQLOLE_E_ NULLRLOGINALREADYEXISTS	A NULL Remote Login already exists for this Remote Server.
SQLOLE_E_ RLOGINALREADYEXISTS	A Remote Login with the remote name '%s' already exists for this Remote Server.
SQLOLE_E_ REMOTENEEDSLOCAL	A Remote Login's Remote Name cannot be specified without also specifying a Local Name.
SQLOLE_E_ BACKUPNEEDSDEVICE	You must specify a backup device for Dump or Load.
SQLOLE_E_ NEEDMANUALFILTERNAME	Specifying the ManualSyncView ReplicationType requires supplying the name of an existing (manually-created) view.
SQLOLE_E_TASKINCOMPLETE	You must specify a task name.
SQLOLE_E_ARTINCOMPLETE	Article definition must include Article name and the name of the Table being published.
SQLOLE_E_PUBINCOMPLETE	Publication definition must include Publication name.
SQLOLE_E_SUBINCOMPLETE	Subscription definition must include the subscribing Remote Server's name.
SQLOLE_E_ALERTINCOMPLETE	Alert definition must include name.
SQLOLE_E_ OPERATORINCOMPLETE	Operator definition must include name.
SQLOLE_E_NAMEMUSTMATCH	The name specified in the Text property's 'CREATE ...' statement must match the Name property, and must be followed by valid TSQL statements.
SQLOLE_E_ TRIGREQTABLENAME	You must specify the Parent Table's name in the Text property's 'CREATE...' statement.
SQLOLE_E_MUSTBESYNCTASK	Tasks created as a Publication's InitialSyncTask must have a 'SYNC' SubSystem.
SQLOLE_E_ NOEVENTCOMPLETION	Either of the EventTypes or CompletionTypes properties may be set, but not both.
SQLOLE_E_FKEYINCOMPLETE	Foreign Key definition must include a referenced Table name and list of columns in the referenced Table which matches the number of columns in the Key Table.
SQLOLE_E_KEYINCOMPLETE	DRI Key definition must include key type and a list of columns in the key.
SQLOLE_E_ KEYALREADYEXISTS	A Key with this name already exists on this table.
SQLOLE_E_CHECKINCOMPLETE	DRI Check definition must include text of the data validation.
SQLOLE_E_ DRIDEFAULTINCOMPLETE	DRI Default definition must include text of the data value, which may be '' (a blank string) for NULL.
SQLOLE_E_ CHECKALREADYEXISTS	A Check with this name already exists on this table.
SQLOLE_E_ ONLYONEPRIMARYKEY	There is already a primary key in this table's key collection.
SQLOLE_E_ NEEDMANUALVIEWNAME	Specifying the ManualFilterProc ReplicationType requires supplying the name of an existing (manually-created) stored procedure.
SQLOLE_ECAT_ INVALIDPARAMETER
SQLOLE_E_ BADCOLLEN	Column length must be between 1 and 255 (0 is allowed for non-length datatypes).
SQLOLE_E_ INVALIDPERFMONSET	The PerfMonMode must be either Continuous or OnDemand.
SQLOLE_E_BADDEVICETYPE	Invalid device type.
SQLOLE_E_ SIZEGREATERTHAN0	Size must be greater than 0.
SQLOLE_E_ RESULTSETOUTOFRANGE	Specified result set is outside the range of result sets returned by this query.
SQLOLE_E_ OUTPUTPARAMREQUIRED	You must specify an output parameter.
SQLOLE_E_PROPTEXTNONNULL	The text for this property cannot be blank or NULL.
SQLOLE_E_BADPROCTYPE	Invalid StoredProcedure type.
SQLOLE_E_BADFILLFACTOR	Fill factor must be between 0 (use default) and 100.
SQLOLE_E_INVALIDINDEXTYPE	Invalid index-type option.
SQLOLE_E_INVALIDPRIVTYPE	Invalid privilege-type option for this object.
SQLOLE_E_BADTRIGTYPE	Invalid trigger-type option.
SQLOLE_E_ INVALIDDAYOFWEEK	Day of week index must be between 1 and 7.
SQLOLE_E_INVALIDMONTH	Month index must be between 1 and 12.
SQLOLE_E_BADDAYCOUNT	You must enter exactly 7 day names.
SQLOLE_E_BADMONTHCOUNT	You must enter exactly 12 month names.
SQLOLE_E_BADCONFIGVALUE	New values for configuration option '%s' must be between %ld and %ld.
SQLOLE_E_ INVALIDPARAMINDEX	Invalid index parameter type; must be string or numeric ordinal, or an object; check documentation for this function.
SQLOLE_E_ INVALIDPARAMRANGE	Invalid parameter or parameter value out of range.
SQLOLE_E_INVALIDDBOBJTYPE	Invalid database-object type.
SQLOLE_E_ ROWCOLOUTOFRANGE	Row or column specified is outside the range of the specified query result set.
SQLOLE_E_NONUNIQUENAME	The object name '%s' is not unique.
SQLOLE_E_ NOTIMESTAMPUDDT	User-defined datatypes based on the 'timestamp' datatype are not allowed.
SQLOLE_E_INVALIDNAME	The name '%s' is not a valid object identifier, or is not a valid format for this property or method.
SQLOLE_E_ INVALIDCOMPLETION	Assigned CompletionLevel must be Failure or Success.
SQLOLE_E_NAMETOOLONG	Maximum string length for this property or method is %ld.
SQLOLE_E_INVALIDFREQTYPE	FrequencyType must be Daily, Weekly, or Monthly.
SQLOLE_E_ INVALIDFREQSUBDAY	FrequencySubDay must be Hour, Minute, or Second.
SQLOLE_E_ INVALIDFREQRELINTERVAL	FrequencyRelativeInterval must be First, Second, Third, Fourth, or Last.
SQLOLE_E_ BADWEEKLYINTERVAL	Weekly Interval must be one or more WeekDay values; consult your documentation.
SQLOLE_E_ BADMONTHLYINTERVAL	Monthly Relative Interval must be a single MonthDay value; consult your documentation.
SQLOLE_E_ BADMONTHLYRELINTERVAL	Monthly Relative Interval must be a single First thru Fourth, or Last; consult your documentation.
SQLOLE_E_INVALIDSRVOPTION	Invalid Remote Server option.
SQLOLE_E_ INVALIDRUNPRIORITY	Invalid Run Priority.
SQLOLE_E_DBNAMEREQUIRED	Database name required.
SQLOLE_E_ PUBNAMEREQUIRED	Publication name required.
SQLOLE_E_ PROPINDEXOUTOFRANGE	Specified index is out of the range of properties for this object.
SQLOLE_E_ INVALIDNOTIFYTYPE	Property must be a valid SQLOLE_NOTIFY_TYPE.
SQLOLE_E_ INVALIDENUMNOTIFYTYPE	Property must be a valid SQLOLE_ENUMNOTIFY_TYPE.
SQLOLE_E_INVALIDWEEKDAY	Weekday parameter must be a bitmask of SQLOLE_WEEKDAY_TYPE (1, 2, 4, 8, 16, 32, 64).
SQLOLE_E_ INVALIDOBJECTTYPE	The input object's type is invalid for this method.
SQLOLE_E_OBJECTREQUIRED	An input object must be specified.
SQLOLE_E_INVALIDEVENTTYPE	Invalid event type; must be a valid (non-Unknown) value in SQLOLE_EVENT_TYPE.
SQLOLE_E_ INVALIDCOMPLETIONTYPE	Invalid completion type; must be a valid (non-Unknown) value in SQLOLE_COMPLETION_TYPE.
SQLOLE_E_INVALIDKEYTYPE	Invalid key type.
SQLOLE_E_ TABLEMUSTBECREATED	This property or method requires that the table object already be created on the server.
SQLOLE_E_ INVALIDPREARTICLE	Invalid article pre-creation method.
SQLOLE_E_ INVALIDSECURITYMODE	Invalid Security mode.
SQLOLE_E_INVALIDPREC	Numeric precision must be greater than 0 and less than or equal to the maximum precision (%ld) specified for this server.
SQLOLE_E_ INVALIDDEPENDENCYTYPE	DependencyType must be a valid value from SQLOLE_DEPENDENCY_TYPE.
SQLOLE_E_ INVALIDVERIFYCONNTYPE	VerifyType must be a valid value from SQLOLE_VERIFYCONN_TYPE.
SQLOLE_E_ INVALIDSTATUSINFOTYPE	The StatusInfoType must be a non-Unknown member of the SQLOLE_STATUSINFO_TYPE enumeration.
SQLOLE_E_ INVALIDFORWARDINGSEVERITY	The ForwardingSeverity must be between 1 and 25, or 110, 120, 130, or 140.
SQLOLE_E_ INVALIDFORWARDINGSERVER	The ForwardingServer cannot be the current server.
SQLOLE_E_ INVALIDRESTARTINTERVAL	The RestartSQLServerInterval must be between 1 and 60 minutes.
SQLOLE_E_ INVALIDHISTORYROWSMAX	The LimitHistoryRowsMax must be greater than 1.
SQLOLE_E_NAMETOOSHORT	Minimum string length for this property or method is %ld.
SQLOLE_E_UNEXPECTED	Unexpected parameter value or other condition.
SQLOLE_ECAT_ INVALIDPLATFORM
SQLOLE_E_BACKUPSQL60ONLY	Backup options other than UnloadTapeAfter, DumpInitDeviceBefore, LoadFileNumber, and single backup devices require Microsoft SQL Server Version 6.0 or later.
SQLOLE_E_MSSQLONLY	This method or property is only available for Microsoft SQL Servers.
SQLOLE_E_WIN95REQUIRESCONN	This method is not available to unconnected servers unless on Windows NT clients.
SQLOLE_E_NOTONWIN95	This method is only available on Windows NT clients.
SQLOLE_E_SQL60ONLY	This property or method requires Microsoft SQL Server Version 6.0 or later.
SQLOLE_E_REPLSQL60ONLY	Replication and Scheduling Management requires Microsoft SQL Server Version 6.0 or later.
SQLOLE_E_ STARTUPPROCSQL60ONLY	Specifying startup procedures requires Microsoft SQL Server Version 6.0 or later.
SQLOLE_E_NEEDSQLOLEPROCS	This server has not installed version %ld.%ld or later of the Microsoft SQL-DMO (SQLOLE) stored procedures for its SQL Server version. The connection is denied.
SQLOLE_E_ALTERSQL60ONLY	Changing this property after object creation requires Microsoft SQL Server Version 6.0 or later.
SQLOLE_E_ SORTEDDATAREORGSQL60ONLY	Specifying SQLOLEIndex_SortedDataReorg requires Microsoft SQL Server Version 6.0 or later.
SQLOLE_E_MSSQLNTONLY	This version of the Microsoft SQL Distributed Managment Objects requires a Microsoft Windows NT SQL Server version 4.21 or later.
SQLOLE_E_ WIN95REQUIRESSQL60	This method or property is not available on a pre-6.0 version of Microsoft SQL Server when SQL-DMO is running on Windows 95.
SQLOLE_ECAT_ ITEMNOTFOUND
SQLOLE_E_RULENOTFOUND	Rule '%s' not found.
SQLOLE_E_DEFAULTNOTFOUND	Default '%s' not found.
SQLOLE_E_TYPENOTFOUND	Data type '%s' not found.
SQLOLE_E_LOGINNOTFOUND	Login '%s' not found.
SQLOLE_E_GROUPNOTFOUND	Group '%s' not found.
SQLOLE_E_LANGNOTFOUND	Language '%s' not found.
SQLOLE_E_DBNOTFOUND	Database '%s' not found.
SQLOLE_E_DEVICENOTFOUND	Device '%s' not found.
SQLOLE_E_COLUMNNOTFOUND	Column '%s' not found in table '%s'.
SQLOLE_E_ORDOUTOFRANGE	The passed ordinal is out of range of the specified collection.
SQLOLE_E_NAMENOTFOUND	The name '%s' was not found in the specified collection.
SQLOLE_E_USERNOTFOUND	User '%s' not found.
SQLOLE_E_NAMENOTINCACHE	Internal error:  Name not found in cache.
SQLOLE_E_ PROPNAMENOTFOUND	Specified name is not a property of this object.
SQLOLE_E_IDNOTFOUND	The ID '%ld' was not found in the specified collection.
SQLOLE_ECAT_ UNPRIVILEGEDLOGIN
SQLOLE_E_MUSTBESAORDBO	Only the System Administrator or Database Owner can perform this operation.
SQLOLE_E_MUSTBESAORLOGIN	You must be logged in as 'sa' or this object's login to perform this operation.
SQLOLE_E_MUSTBESA	You must be logged in as 'sa' to perform this operation.
SQLOLE_ECAT_EXECUTION
SQLOLE_E_SYSPROCERROR	SQL Server message text.
SQLOLE_E_CACHEEXECERROR	Error encountered on executing or updating associated query.
SQLOLE_E_INACCESSIBLEDB	This database has been marked Inaccessible.
SQLOLE_E_ BATCHCOMPLETEWITHERRORS	SQL Server message text.
SQLOLE_ECAT_CONNECTION
SQLOLE_E_CANTRECONNDEADCONN	This server connection has been unexpectedly broken and cannot be reconnected.
SQLOLE_ECAT_RESOURCE
SQLOLE_E_OUTOFMEMORY	Out of memory.
SQLOLE_E_NOMOREDEVNOS	The maximum of 256 devices already exists on this server.
SQLOLE_E_LASTERROR


SQLOLE_EVENT_TYPE

Values

SQLOLEEvent_Unknown

SQLOLEEvent_Info

SQLOLEEvent_Warning

SQLOLEEvent_Error

SQLOLEEvent_AuditSuccess

SQLOLEEvent_AuditFailure

SQLOLEEvent_All


SQLOLE_EXEC_TYPE

Values

SQLOLEExec_Default

SQLOLEExec_NoCommandTerm

SQLOLEExec_ContinueOnError

SQLOLEExec_NoExec

SQLOLEExec_ParseOnly


SQLOLE_FREQRELATIVE_TYPE

Values

SQLOLEFreqRel_Unknown

SQLOLEFreqRel_First

SQLOLEFreqRel_Second

SQLOLEFreqRel_Third

SQLOLEFreqRel_Fourth

SQLOLEFreqRel_Last

SQLOLEFreqRel_Valid


SQLOLE_FREQSUB_TYPE

Values

SQLOLEFreqSub_Unknown

SQLOLEFreqSub_Once

SQLOLEFreqSub_Minute

SQLOLEFreqSub_Hour

SQLOLEFreqSub_Valid


SQLOLE_FREQUENCY_TYPE

Values

SQLOLEFreq_Unknown

SQLOLEFreq_OneTime

SQLOLEFreq_OnDemand

SQLOLEFreq_Daily

SQLOLEFreq_Weekly

SQLOLEFreq_Monthly

SQLOLEFreq_MonthlyRelative

SQLOLEFreq_Autostart

SQLOLEFreq_Recurring

SQLOLEFreq_Valid


SQLOLE_INDEX_TYPE

Values

SQLOLEIndex_Default

SQLOLEIndex_IgnoreDupKey

SQLOLEIndex_Unique

SQLOLEIndex_IgnoreDupRow

SQLOLEIndex_Clustered

SQLOLEIndex_AllowDupRow

SQLOLEIndex_SortedData

SQLOLEIndex_SortedDataReorg

SQLOLEIndex_Valid

SQLOLEIndex_DRIPrimaryKey

SQLOLEIndex_DRIUniqueKey

SQLOLEIndex_DRIIndex


SQLOLE_INITIALSYNC_TYPE

Values

SQLOLEInitSync_Unknown

SQLOLEInitSync_Min

SQLOLEInitSync_BCPNative

SQLOLEInitSync_BCPChar

SQLOLEInitSync_TableDumpLoad

SQLOLEInitSync_Max


SQLOLE_INTSECLOGIN_TYPE

Values

SQLOLEIntSecLogin_Unknown

SQLOLEIntSecLogin_Min

SQLOLEIntSecLogin_Admin

SQLOLEIntSecLogin_User

SQLOLEIntSecLogin_Replication

SQLOLEIntSecLogin_Max


SQLOLE_KEY_TYPE

Values

SQLOLEKey_Unknown

SQLOLEKey_Primary

SQLOLEKey_Unique

SQLOLEKey_Foreign


SQLOLE_MEDIA_TYPE

Values

SQLOLEMedia_Floppy

SQLOLEMedia_FixedDisk

SQLOLEMedia_Tape

SQLOLEMedia_CDROM

SQLOLEMedia_All


SQLOLE_MIRROR_TYPE

Values

SQLOLEMirror_None

SQLOLEMirror_Inactive

SQLOLEMirror_RunningOnMirror

SQLOLEMirror_Active


SQLOLE_MONTHDAY_TYPE

Values

SQLOLEMonth_Unknown

SQLOLEMonth_MinValid

SQLOLEMonth_Sunday

SQLOLEMonth_Monday

SQLOLEMonth_Tuesday

SQLOLEMonth_Wednesday

SQLOLEMonth_Thursday

SQLOLEMonth_Friday

SQLOLEMonth_Saturday

SQLOLEMonth_Day

SQLOLEMonth_WeekDay

SQLOLEMonth_WeekEndDay

SQLOLEMonth_MaxValid


SQLOLE_NOTIFY_TYPE

Values

SQLOLENotify_None

SQLOLENotify_Email

SQLOLENotify_Pager

SQLOLENotify_Both

SQLOLENotify_Valid


Chapter 8   SQLOLE_OBJECT_TYPE
SQLOLE_OBJECT_TYPE

Values

SQLOLEObj_Unknown

SQLOLEObj_Application

SQLOLEObj_UserDefinedDatatype

SQLOLEObj_SystemTable

SQLOLEObj_View

SQLOLEObj_UserTable

SQLOLEObj_StoredProcedure

SQLOLEObj_Default

SQLOLEObj_Rule

SQLOLEObj_Trigger

SQLOLEObj_AllDatabaseUserObjects

SQLOLEObj_AllDatabaseObjects

SQLOLEObj_SystemDatatype

SQLOLEObj_User

SQLOLEObj_Group

SQLOLEObj_Index

SQLOLEObj_Key

SQLOLEObj_Column

SQLOLEObj_DBObject

SQLOLEObj_DBOption

SQLOLEObj_ProcedureParameter

SQLOLEObj_Permission

SQLOLEObj_IntegratedSecurity

SQLOLEObj_Check

SQLOLEObj_DRIDefault

SQLOLEObj_SQLServer

SQLOLEObj_Database

SQLOLEObj_Device

SQLOLEObj_Login

SQLOLEObj_Language

SQLOLEObj_RemoteServer

SQLOLEObj_RemoteLogin

SQLOLEObj_Configuration

SQLOLEObj_ConfigValue

SQLOLEObj_AlertSystem

SQLOLEObj_Executive

SQLOLEObj_QueryResults

SQLOLEObj_TransactionLog

SQLOLEObj_Registry

SQLOLEObj_Transfer

SQLOLEObj_Backup

SQLOLEObj_Task

SQLOLEObj_Alert

SQLOLEObj_Operator

SQLOLEObj_HistoryFilter

SQLOLEObj_Publication

SQLOLEObj_Article

SQLOLEObj_Subscription

SQLOLEObj_SubscriberInfo

SQLOLEObj_AutoProperty


SQLOLE_OBJSORT_TYPE

Values

SQLOLEObjSort_Name

SQLOLEObjSort_Type

SQLOLEObjSort_Owner

SQLOLEObjSort_Date


SQLOLE_PERFMON_TYPE

Values

SQLOLEPerfmon_None

SQLOLEPerfmon_MinSet

SQLOLEPerfmon_Continuous

SQLOLEPerfmon_OnDemand

SQLOLEPerfmon_MaxSet


SQLOLE_PREARTICLE_TYPE

Values

SQLOLEPreArt_Min

SQLOLEPreArt_None

SQLOLEPreArt_DropTable

SQLOLEPreArt_DeleteRows

SQLOLEPreArt_TruncateTable

SQLOLEPreArt_Max


SQLOLE_PRIVILEGE_TYPE

Values

SQLOLEPriv_Unknown

SQLOLEPriv_Select

SQLOLEPriv_Insert

SQLOLEPriv_Update

SQLOLEPriv_Delete

SQLOLEPriv_Execute

SQLOLEPriv_References

SQLOLEPriv_AllObjectPrivs

SQLOLEPriv_CreateTable

SQLOLEPriv_CreateDatabase

SQLOLEPriv_CreateView

SQLOLEPriv_CreateProcedure

SQLOLEPriv_DumpDatabase

SQLOLEPriv_CreateDefault

SQLOLEPriv_DumpTransaction

SQLOLEPriv_CreateRule

SQLOLEPriv_AllDatabasePrivs


SQLOLE_PROCEDURE_TYPE

Values

SQLOLEProc_Unknown

SQLOLEProc_Standard

SQLOLEProc_Extended

SQLOLEProc_Macro

SQLOLEProc_ReplicationFilter


SQLOLE_QUERY_DATATYPE

Values

SQLOLE_DTypeUnknown

SQLOLE_DTypeChar

SQLOLE_DTypeText

SQLOLE_DTypeVarchar

SQLOLE_DTypeVarBinary

SQLOLE_DTypeBinary

SQLOLE_DTypeImage

SQLOLE_DTypeFloat4

SQLOLE_DTypeFloat8

SQLOLE_DTypeInt1

SQLOLE_DTypeInt2

SQLOLE_DTypeInt4

SQLOLE_DTypeMoney4

SQLOLE_DTypeMoney

SQLOLE_DTypeDateTime

SQLOLE_DTypeDateTime4

SQLOLE_DTypeBit


SQLOLE_REPFREQ_TYPE

Values

SQLOLERepFreq_Unknown

SQLOLERepFreq_Min

SQLOLERepFreq_Continuous

SQLOLERepFreq_Snapshot

SQLOLERepFreq_Max


SQLOLE_REPLICATION_TYPE

Values

SQLOLERep_Unknown

SQLOLERep_LogBased

SQLOLERep_ManualFilterProc

SQLOLERep_LogBasedManualFilterProc

SQLOLERep_ManualSyncView

SQLOLERep_LogBasedManualSyncView

SQLOLERep_LogBasedManualBoth

SQLOLERep_Valid


SQLOLE_RUNPRIORITY_TYPE

Values

SQLOLERunPri_Unknown

SQLOLERunPri_Min

SQLOLERunPri_Idle

SQLOLERunPri_Lowest

SQLOLERunPri_BelowNormal

SQLOLERunPri_Normal

SQLOLERunPri_AboveNormal

SQLOLERunPri_Highest

SQLOLERunPri_TimeCritical


SQLOLE_SCRIPT_TYPE

Values

SQLOLEScript_Default

SQLOLEScript_Drops

SQLOLEScript_ObjectPermissions

SQLOLEScript_PrimaryObject

SQLOLEScript_ClusteredIndexes

SQLOLEScript_Triggers

SQLOLEScript_DatabasePermissions

SQLOLEScript_Permissions

SQLOLEScript_ToFileOnly

SQLOLEScript_Bindings

SQLOLEScript_AppendToFile

SQLOLEScript_NoDRI

SQLOLEScript_UDDTsToBaseType

SQLOLEScript_42Syntax

SQLOLEScript_ODBCSyntax

SQLOLEScript_IncludeIfNotExists

SQLOLEScript_NonClusteredIndexes

SQLOLEScript_Indexes

SQLOLEScript_Aliases

SQLOLEScript_NoCommandTerm

SQLOLEScript_DRIIndexes

SQLOLEScript_IncludeHeaders

SQLOLEScript_OwnerQualify

SQLOLEScript_TimestampToBinary


SQLOLE_SECURITY_TYPE

Values

SQLOLESecurity_Min

SQLOLESecurity_Normal

SQLOLESecurity_Integrated

SQLOLESecurity_Mixed

SQLOLESecurity_Max


SQLOLE_SRVOPTION_TYPE

Values

SQLOLESrvOpt_Unknown

SQLOLESrvOpt_RPC

SQLOLESrvOpt_Publisher

SQLOLESrvOpt_Subscriber

SQLOLESrvOpt_Distributor

SQLOLESrvOpt_DistPublisher

SQLOLESrvOpt_Valid


SQLOLE_SRVUSERPROFILE_TYPE

Values

SQLOLESrvUserProf_None

SQLOLESrvUserProf_SaLogin

SQLOLESrvUserProf_CreateDatabase

SQLOLESrvUserProf_AllProfileBits


SQLOLE_STARTSRV_TYPE

Values

SQLOLEStart_NoServiceControl

SQLOLEStart_NTErrorLogging

SQLOLEStart_SingleUser

SQLOLEStart_StartAndConnect

SQLOLEStart_RealTime

SQLOLEStart_Defaults


SQLOLE_STATUSINFO_TYPE

Values

SQLOLEStatInfo_Unknown

SQLOLEStatInfo_DatabaseStatus

SQLOLEStatInfo_DatabaseSpace

SQLOLEStatInfo_All


SQLOLE_SUBSTATUS_TYPE

Values

SQLOLESubStat_Unknown

SQLOLESubStat_Min

SQLOLESubStat_Inactive

SQLOLESubStat_Unsynced

SQLOLESubStat_Active

SQLOLESubStat_Max


SQLOLE_SUBSYNC_TYPE

Values

SQLOLESubSync_Unknown

SQLOLESubSync_Min

SQLOLESubSync_Documentation

SQLOLESubSync_Auto

SQLOLESubSync_None

SQLOLESubSync_Max


SQLOLE_SVCSTATUS_TYPE

Values

SQLOLESvc_Unknown

SQLOLESvc_Running

SQLOLESvc_Paused

SQLOLESvc_Stopped

SQLOLESvc_Starting

SQLOLESvc_Stopping

SQLOLESvc_Continuing

SQLOLESvc_Pausing


SQLOLE_TABLEATT_TYPE

Values

SQLOLETabAtt_Identity

SQLOLETabAtt_SystemObject

SQLOLETabAtt_ForeignKey

SQLOLETabAtt_Referenced

SQLOLETabAtt_Published

SQLOLETabAtt_Replicated

SQLOLETabAtt_Check

SQLOLETabAtt_Replica

SQLOLETabAtt_PrimaryKey

SQLOLETabAtt_Unique

SQLOLETabAtt_Default

SQLOLETabAtt_ReplCheck

SQLOLETabAtt_HasConstraint


SQLOLE_TRIGGER_TYPE

Values

SQLOLETrig_Unknown

SQLOLETrig_Insert

SQLOLETrig_Update

SQLOLETrig_Delete

SQLOLETrig_All


SQLOLE_VERIFYCONN_TYPE

Values

SQLOLEConn_LastState

SQLOLEConn_CurrentState

SQLOLEConn_ReconnectIfDead

SQLOLEConn_Valid


SQLOLE_WEEKDAY_TYPE

Values

SQLOLEWeek_Unknown

SQLOLEWeek_Sunday

SQLOLEWeek_Monday

SQLOLEWeek_Tuesday

SQLOLEWeek_Wednesday

SQLOLEWeek_Thursday

SQLOLEWeek_Friday

SQLOLEWeek_Saturday

SQLOLEWeek_WeekDays

SQLOLEWeek_WeekEnds

SQLOLEWeek_EveryDay