SMO and Sql Server 7.0

时光毁灭记忆、已成空白 提交于 2019-12-04 05:49:20

问题


Does anyone have a definitive answer to whether Sql Server Management Objects is compatible with Sql Server 7.0? The docs state:

Because SMO is compatible with SQL Server version 7.0, SQL Server 2000, SQL Server 2005, and SQL Server 2008, you easily manage a multi-version environment.

But trying to connect to a Sql 7 instance gets me:

"This SQL Server version (7.0) is not supported."

Has anyone been successful in getting these 2 to play nice?


回答1:


you can use SMO to connect to SQL Server versions 7, 2000, and 2005, but SMO does not support databases set to compatibility levels 60, 65, and 70.

for SQL Server 7.0 the compatibility level is 70

Obviously this is conflicting information...I assume if your compatibility level of your DB is 70 you can not connect.

To check run: EXEC sp_dbcmptlevel 'databasename'

Looking through this link, it seems you might be able to change the compatibility level by running this:

EXEC sp_dbcmptlevel 'databasename', 80

Obviously make a back up before changing anything.




回答2:


Looks like the docs are wrong (and have continued to be wrong for the last 3+ years!). I found this snippet with Reflector in Microsoft.SqlServer.Management.Common.ConnectionManager, Microsoft.SqlServer.ConnectionInfo

protected void CheckServerVersion(ServerVersion version) {
    if ((version.Major <= 7 || (version.Major > 9)) {
       throw new ConnectionFailureException(
          StringConnectionInfo.ConnectToInvalidVersion(version.ToString())
       );
    }
}

So, it looks like only SQL 2000 and SQL 2005 are supported. Presumably, SQL 2008 (version 10) has updated SMO assemblies.

Bummer - guess it's back to SQL-DMO for this project.




回答3:


Just to follow up on your commment SQL 2008 does have its own SMO package which supports SQL 2000, 2005 and 2008 which is actually definitively documented on their download page! And you're right you can't connect SQL 2005 SMO to SQL 2008.

There are some nice updates updates in Version 10 of the SMO in that if you access properties that do not existing on the version of SQL that you are connect to you get a sensible "This property is not available on this Version of SQL" exception or words to that effect.

Microsoft SQL Server 2008 Management Objects The SQL Server Management Objects (SMO) is a .NET Framework object model that enables software developers to create client-side applications to manage and administer SQL Server objects and services. This object model will work with SQL Server 2000, SQL Server 2005 and SQL Server 2008.




回答4:


Sorry for the late answer... there is partial support for SQL 2000 and SQL 7



来源:https://stackoverflow.com/questions/33457/smo-and-sql-server-7-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!