Showing posts with label respect. Show all posts
Showing posts with label respect. Show all posts

Friday, February 17, 2012

Compatiblity of SQLDMO and SQLSMO with respect to scripting via COM

Hi all,

I need your help:

Context:
I have developed since long an installation with InstallShield's InstallScript language. This installation "talks" to SQLServer2000 in order to install, upgrade, backup and restore the application's database. All this is done in the InstallScript code using SQLDMO currently, using the COM interface as if using VB script.

Problem:
Now as we are preparing to support installation on SQL2005, I am investigating the usage of SQLSMO, as SQLDMO cannot be excepted on all target systems (SQLExpress must be supported, too).

I looked in the SMO namespace and recognized, that the contained classes are registered as COM objects, too. Due to this I have no problem creating a Microsoft.SqlServer.Management.Smo.Server object from my scripting code.
But - opposed to SQLDMO the SMO server object does not have a Connect() method.

Looking further I found the Microsoft.SqlServer.Management.Common.ServerConnection object which seems to have the functionality I need - but this object is not registered as a COM object and as such is not scriptable - I am stuck :-(

Generally it seems, that SQLSMO is by far not a replacement or enhancement to SQLDMO. So - how to solve tasks which where using SQLDMO up to now?

Please - give advice!

Thanks,
Jo

Sorry, Jo, you're correct with respect to COM support for SMO - it's not there. It's not hard to build a VB console application to do what you're attempting, though, and then you can connect to the server either through the Connect() method or by setting arguments in the ServerConnection object. I've used both successfully.

There's a lot of argument in this forum whether or not SMO is an enhancement to DMO, and while some have had some performance issues with SMO, I feel that the object model is much more straightforward and easy to use than its predecessor. We just have to approach things differently.

Tuesday, February 14, 2012

Compatibility level bug?

I think found a bug in SQL Server 2005 with respect to the database
compatibility level.
Scenario:
2 DBs on the same SQL Server 2005:
- fbSunshore
- swSunshore
Both DBs with compatibility level set to SQL Server 2005
Both DBs have a table 'Steuerschluessel'
Test 1:
Run the following statements:
USE swSunshore
UPDATE Steuerschluessel SET Info = '?'
Result: NO problem!!
Test 2:
Run the following statements:
USE swSunshore
UPDATE Steuerschluessel SET Info = '?'
FROM Steuerschluessel AS ThisTable
INNER JOIN fbSunshore..Steuerschluessel
ON ThisTable.Steuerschluessel
= fbSunshore..Steuerschluessel.Steuerschluessel
Result: 'Invalid columns name: 'info':
Test 3:
Set the compatibility level of swSunshore to SQL Server 2000
an rerun the statements from Test2
USE swSunshore
UPDATE Steuerschluessel SET Info = '?'
FROM Steuerschluessel AS ThisTable
INNER JOIN fbSunshore..Steuerschluessel
ON ThisTable.Steuerschluessel
= fbSunshore..Steuerschluessel.Steuerschluessel
Result: NO problem
AFAIK info is not a reserved word in SQL Server 2005, so I can not find a
reason for this behavior.
Any idea?
Bernd Beekes
have you tried this
USE swSunshore
UPDATE ThisTable.Steuerschluessel SET ThisTable.Info = '?'
FROM Steuerschluessel AS ThisTable
INNER JOIN fbSunshore..Steuerschluessel
ON ThisTable.Steuerschluessel
= fbSunshore..Steuerschluessel.Steuerschluessel
"BerndB" <BerndB@.discussions.microsoft.com> wrote in message
news:B9B02693-E908-4CD2-B9C7-E115A5F268EE@.microsoft.com...
> I think found a bug in SQL Server 2005 with respect to the database
> compatibility level.
> Scenario:
> 2 DBs on the same SQL Server 2005:
> - fbSunshore
> - swSunshore
> Both DBs with compatibility level set to SQL Server 2005
> Both DBs have a table 'Steuerschluessel'
> Test 1:
> Run the following statements:
> USE swSunshore
> UPDATE Steuerschluessel SET Info = '?'
> Result: NO problem!!
> Test 2:
> Run the following statements:
> USE swSunshore
> UPDATE Steuerschluessel SET Info = '?'
> FROM Steuerschluessel AS ThisTable
> INNER JOIN fbSunshore..Steuerschluessel
> ON ThisTable.Steuerschluessel
> = fbSunshore..Steuerschluessel.Steuerschluessel
> Result: 'Invalid columns name: 'info':
> Test 3:
> Set the compatibility level of swSunshore to SQL Server 2000
> an rerun the statements from Test2
> USE swSunshore
> UPDATE Steuerschluessel SET Info = '?'
> FROM Steuerschluessel AS ThisTable
> INNER JOIN fbSunshore..Steuerschluessel
> ON ThisTable.Steuerschluessel
> = fbSunshore..Steuerschluessel.Steuerschluessel
> Result: NO problem
> AFAIK info is not a reserved word in SQL Server 2005, so I can not find a
> reason for this behavior.
> Any idea?
> --
> Bernd Beekes
|||Thank You! it works!
Ihad to introduce the 'ThisTable' alias after upgrading to SQL Server 2005
(i. e. in SQL 2000 everything was OK w/o that alias). So there is at least
some logic in this ...
Bernd Beekes
"tolgay" wrote:
...

Compatibility level bug?

I think found a bug in SQL Server 2005 with respect to the database
compatibility level.
Scenario:
2 DBs on the same SQL Server 2005:
- fbSunshore
- swSunshore
Both DBs with compatibility level set to SQL Server 2005
Both DBs have a table 'Steuerschluessel'
Test 1:
Run the following statements:
USE swSunshore
UPDATE Steuerschluessel SET Info = '?'
Result: NO problem!!
Test 2:
Run the following statements:
USE swSunshore
UPDATE Steuerschluessel SET Info = '?'
FROM Steuerschluessel AS ThisTable
INNER JOIN fbSunshore..Steuerschluessel
ON ThisTable.Steuerschluessel
= fbSunshore..Steuerschluessel.Steuerschluessel
Result: 'Invalid columns name: 'info':
Test 3:
Set the compatibility level of swSunshore to SQL Server 2000
an rerun the statements from Test2
USE swSunshore
UPDATE Steuerschluessel SET Info = '?'
FROM Steuerschluessel AS ThisTable
INNER JOIN fbSunshore..Steuerschluessel
ON ThisTable.Steuerschluessel
= fbSunshore..Steuerschluessel.Steuerschluessel
Result: NO problem
AFAIK info is not a reserved word in SQL Server 2005, so I can not find a
reason for this behavior.
Any idea?
Bernd Beekeshave you tried this
USE swSunshore
UPDATE ThisTable.Steuerschluessel SET ThisTable.Info = '?'
FROM Steuerschluessel AS ThisTable
INNER JOIN fbSunshore..Steuerschluessel
ON ThisTable.Steuerschluessel
= fbSunshore..Steuerschluessel.Steuerschluessel
"BerndB" <BerndB@.discussions.microsoft.com> wrote in message
news:B9B02693-E908-4CD2-B9C7-E115A5F268EE@.microsoft.com...
> I think found a bug in SQL Server 2005 with respect to the database
> compatibility level.
> Scenario:
> 2 DBs on the same SQL Server 2005:
> - fbSunshore
> - swSunshore
> Both DBs with compatibility level set to SQL Server 2005
> Both DBs have a table 'Steuerschluessel'
> Test 1:
> Run the following statements:
> USE swSunshore
> UPDATE Steuerschluessel SET Info = '?'
> Result: NO problem!!
> Test 2:
> Run the following statements:
> USE swSunshore
> UPDATE Steuerschluessel SET Info = '?'
> FROM Steuerschluessel AS ThisTable
> INNER JOIN fbSunshore..Steuerschluessel
> ON ThisTable.Steuerschluessel
> = fbSunshore..Steuerschluessel.Steuerschluessel
> Result: 'Invalid columns name: 'info':
> Test 3:
> Set the compatibility level of swSunshore to SQL Server 2000
> an rerun the statements from Test2
> USE swSunshore
> UPDATE Steuerschluessel SET Info = '?'
> FROM Steuerschluessel AS ThisTable
> INNER JOIN fbSunshore..Steuerschluessel
> ON ThisTable.Steuerschluessel
> = fbSunshore..Steuerschluessel.Steuerschluessel
> Result: NO problem
> AFAIK info is not a reserved word in SQL Server 2005, so I can not find a
> reason for this behavior.
> Any idea?
> --
> Bernd Beekes|||Thank You! it works!
Ihad to introduce the 'ThisTable' alias after upgrading to SQL Server 2005
(i. e. in SQL 2000 everything was OK w/o that alias). So there is at least
some logic in this ...
Bernd Beekes
"tolgay" wrote:
...