Microsoft KB Archive/239794

= INF: Changes to SQL-DMO Objects in SQL Server 7.0 =

Article ID: 239794

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q239794



SUMMARY
SQL Server Distributed Management Objects (DMO) has been redesigned and enhanced to reflect the new SQL Server 7.0 architecture and features, and there is a new DMO object model that must be used to administer SQL 7.0 servers. From the perspective of a SQL-DMO application, the most significant changes to the object model affect database creation and modification, backup and restore, and security.



MORE INFORMATION
The SQL Server 6.5 DMO object model was referred to as "SQLOLE". In SQL Server 7.0 you create a reference to "SQLDMO", instead. The two object models are very similar. If your DMO application must work with both SQL Server 6.5 and SQL 7.0, you may be able to use much of the same code, but there will probably be places where code branches are necessary to handle the differences between the different versions of the DMO objects. There is a sample application (DMOPing) provided with SQL Server 7.0 that demonstrates how to handle the initial connection to determine the SQL Server version so you can decide whether to create your SQLServer object from SQLOLE or SQLDMO. Refer to the SQL Server Books Online topic: "Dmoping (C++) (SQL-DMO)" for a description. Also, you can find the code on the SQL Server CD-ROM in the \DevTools\Samples\sqldmo\cpp\dmoping directory.

Below is sample Visual Basic code that demonstrates SQL Server version detection and instantiation of a SQLServer object from the appropriate library. Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

Dim sServer As String Dim oSQLObj As Object 'Define the server name to which you want to connect. sServer = "MyServer"

'Create the 7.0 version of SQLServer object. Set oSQLObj = CreateObject("SQLDMO.SQLServer") version = oSQLObj.PingSQLServerVersion(sServer) If version <> SQLDMOSQLVer_70 Then 'Create 6.x version if necessary. Set oSQLObj = nothing Set oSQLObj = CreateObject("SQLOLE.SQLServer") End If   'Make a connection through Microsoft Windows NT authentication. oSQLObj.LoginSecure = True oSQLObj.Connect(sServer) If you are using VBScript, you will need to define the appropriate constants to use this code: SQLDMOSQLVer_60 = 2 SQLDMOSQLVer_65 = 4 SQLDMOSQLVer_70 = 8 SQLDMOSQLVer_Pre_60 = 1 SQLDMOSQLVer_Unknown = 0 The following objects and collections are new to the SQL Server 7.0 version of DMO:

FileGroups

FileGroup

DBFiles

DBFile

LogFiles

LogFile

ServerRoles

ServerRole

DatabaseRoles

DatabaseRole

Restore

RestoreSink

JobFilter

JobSchedules

JobSchedule

Schedule

LinkedServers

LinkedServer

LinkedServerLogins

LinkedServerLogin

Jobs

Job

TargetServers

TargetServer

TargetServerGroups

TargetServerGroup

JobCategories

AlertCategories

OperatorCategories

Category

JobSteps

JobStep

The following objects and collections have been renamed in the SQL Server 7.0 version of SQL-DMO:

Devices to BackupDevices

Device to BackupDevice

Executive to JobServer

HistoryFilter to JobHistoryFilter

These objects and collections are present in the SQL Server 6.5 DMO object model, but have been removed in the SQL Server 7.0 version:

Tasks

Task

The Group object is a special object that is accessible to 6.x servers only.

Additional query words: SQLDMO

Keywords: kbinfo KB239794

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.