NAVmoble - the pocket-sized ERP
Optimized for Microsoft Dynamics NAV and Windows Mobile powered devices
Showing posts with label Sql Server. Show all posts
Showing posts with label Sql Server. Show all posts

Thursday, July 16, 2009

Microsoft SQL Server 2005: Property Owner is not available for Database xxxxx

I restored a backup over a fresh MS SQl 2005 instance recently.
I tried to open the properties dialog from the Management Studio/Object Explorer for the restored database and got the following message


Property Owner is not available for Database 'db_name'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. (Microsoft.SqlServer.Smo)


Fortunately, I solved my problem by executing the following query against the restored database:

sp_changedbowner sa

Sunday, February 25, 2007

Sql Server 2005: Change schema for all tables

I recently needed to change the schema for all the tables in a Sql Server 2005 database.
Sql Server 2005 provides a T-SQl statement capable to change the schema for a given object called ALTER SCHEMA
You may use the following syntax to change the schema for all the tables in a database. Just change the "new_schema" string with the desired one:

exec sp_MSforeachtable "ALTER SCHEMA new_schema TRANSFER ? PRINT '? modified' "


Enjoy!