SQL Server 2005 SMO Objects

there was a time that I need to use the SQL Management Objects.
Good thing about these collection is that we can manage our MS SQL Server with ease.

I recommend using SMO in huge backup projects or batch updates/inserts/delete's or maybe managing stored procedures, views, triggers et al against databases. Just thought that smo objects was used in SQL Compare and related products from red-gates. I used their products for a while. You can find more info here.

I'll show you a good example that might help you get started.

First, you need to have the following assemblies:

    Microsoft.SqlServer.ConnectionInfo.dll
    Microsoft.SqlServer.Smo.dll
    Microsoft.SqlServer.SmoEnum.dll

probably, if you leave the default installation directory of your MS SQL Server 2005 standard edition installation then you can find the assemblies in this directory

C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies

These assemblies are available when installing Microsoft SQL Server 2005. If you don't have SQL Server 2005 standard edition installed, you can download the object collection from the "Feature Pack for Microsoft SQL Server 2005 – November 2005". Click here for details.

You only need to download the Microsoft SQL Server 2005 Management Objects Collection.
Scroll down to find the category. Hope Microsoft will not sue me for having this direct link to that:

XMO for x86

XMO for x64

Next, fire-up Visual Studio 2003/2005/2008 Pro/Express. Create new Project and select console application.

Download the project solutions below. Run the app.

Leave a Reply