SQL Server Compatability

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RoninZA
    New Member
    • Jul 2007
    • 78

    #1

    SQL Server Compatability

    Hi -

    I need to set the compatability of a database on a SQL Server 2005 to "SQL Server 2005(90)" programmaticall y. Ideally I would like to use the SMO objects as I already have these objects looking at the database and doing things on it, but a T/SQL script should be fine as well.

    Thanks!
  • RoninZA
    New Member
    • Jul 2007
    • 78

    #2
    OK, I figured it out. Reference Microsoft.SqlSe rver.Smo and Microsoft.SqlSe rver.SqlEnum
    Code:
    using Microsoft.SqlServer.Management.Smo;
    using Microsoft.SqlServer.Management.Common;
    .
    .
    Server server = new Server(new ServerConnection(Server, Username, Password).Connect());
    Database database = new Database(server, connection.Database);
    database.CompatibilityLevel = CompatibilityLevel.Version90;

    Comment

    Working...