Sunday, March 11, 2012

Detaching a Database using SQL-SMO

Hi,

Please let me know how I go about detaching a database in SQL 2005 usng SQL-DMO. I think even before detaching a database we have to clear the connections.

If the solution is provided it will be of great help as it is very critical.

Regards

Kris

Once inititated you can use the:

SomeServer = new Server(); --Has to be modified here
SomeServer.DetachDatabase("MyDatabaseName",false);

HTH, Jens Suessmeyer.

|||

Thanks,

The mentioned code even clears the connection before proceeding to detach the database. If not please let me know the same.

Thanks

Kris

No comments:

Post a Comment