retide
retide

Reputation: 1190

Change database Schema name in database project vs2012

I have a database project that currently is using "dbo" schema. I want to update the dbo to something else.

I am able to find the project setting to change the default dbo schema name, but it only works for the new added table. How can I update existing table from dbo to something else.

Please help me,

Upvotes: 4

Views: 3425

Answers (2)

retide
retide

Reputation: 1190

My questions is to changes existing schema name from dbo to something else.

I finally find a easy way to do it.

I used the sql schema compare in vs 2012 .

1) change the actually database schema. 2) select the actually database as the source and and select my database project as target. 3) do a update. it will update the database project.

Upvotes: 0

Peter Schott
Peter Schott

Reputation: 4681

  1. Open your object, in this case a table.
  2. In the T-SQL view for the table, highlight the table name.
  3. Under the "SQL" menu at the top of the IDE, choose "Refactor" - "Move to Schema"
  4. Select the new schema (and I'd recommend previewing the changes as well)
  5. If you're happy with the proposed changes, click "Apply". If not, click "Cancel".

To change the default schema for all future objects, right-click the Project and select "Properties". Under "Project Settings", change the Default Schema in the "General" section. That won't change existing objects, but new ones will be created in that schema.

Upvotes: 8

Related Questions