LISTING 1: Change Owner of All Tables in Database 'This script changes the ownership of all tables 'that are not dbo to dbo. SET oServer = CreateObject("SQLDMO.SQLServer") oServer.LoginSecure = True ''NT authentication oServer.Connect "localhost" SET oDatabase = oServer.Databases("pubs") FOR EACH oTable IN oDatabase.Tables IF oTable.Owner <> "dbo" THEN oTable.Owner = "dbo" Wscript.Echo oTable.Name & " owner changed to dbo" END IF NEXT MsgBox "Done" ''''Clean up''''' SET oTable = Nothing SET oDatabase = Nothing SET oServer = Nothing