Brian Surowiec
Brian Surowiec

Reputation: 17281

How do you rename columns using a Visual Studio Database Project?

I'm using an SQL Server 2008 Database Prject in Visual Studio 2010 and now I need to rename one of my table columns. Using the SQL Server Data-tier Application project this can be done by right clicking on the item to rename in the Schema View and selecting the Refactor option. I don't see this option in the Database project so how do you rename columns with this project type?

Update: I tried switching the project type over to a Data-tier Application but I'm still not seeing the Refactor option in the Schema View. Is this supported in the Pro version?

Upvotes: 1

Views: 2499

Answers (4)

Shailesh
Shailesh

Reputation: 1218

I do agree with David. Complete feature of real database development is available in Ultimate / premium edition of visual studio but there is a workaround for Visual Studio 2010 professional edition. Steps are mentioned below.

1-Create a blank file “CommonDataPlatform.refactorlog” file inside CommonDatabase project.

2-Right click on “CommonDataPlatform.refactorlog” file and click on properties. Set build action to “Deployment extension configuration”

3-Now open “CommonDataPlatform.refactorlog” in IDE and treat this as an xml document. Write below mentioned XML in it. I am highlighting one example.

Here Email is a table with EmailOldName as old column name and now we are trying to rename EmailOldColumn to EmailAddress.

You can add many Operation nodes for other column name changes.

Note: Key for each Operation node has to be unique.

Hope it will help developers having only VS-2010 Professional Edition as well :).

Upvotes: 0

Brian Surowiec
Brian Surowiec

Reputation: 17281

After looking into this more it seems the refactoring feature is available in the Premium and Ultimate versions of Visual Studio 2010 and not in the Professional version.

Upvotes: 0

David Atkinson
David Atkinson

Reputation: 5899

Are you using the Professional Edition of Visual Studio? It is likely that this feature is available only in the Premium or Ultimate editions.

Upvotes: 1

Mitch Wheat
Mitch Wheat

Reputation: 300559

Get latest source code, and build it.

Deploy Database (to ensure up to date)

Make schema changes in SSMS.

Synch database to your database project model.

Check-in changes

(Or you could just check-out and edit the files directly in the database project)

Upvotes: 1

Related Questions