Design and Development > MSSQL server

Change database schema in SQL 2005 database

(1/1)

Raju:
Hi,

I have restored my SQL 2005 database file (.mdf) file but it shows the database schema to the user that I was using in my local system. How can I set the database schema to dbo ?

Thanks,

Raju

Kailash:
Sql Server 2005 provides a T-SQL statement to change the table schema. You will need to execute following SQL statement to change the schema:

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

Replace your_schema_name with your new schema name.

Kailash

Raju:
Thanks. It worked.

Raju

Navigation

[0] Message Index

Go to full version