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 开发者_如何学JAVAcolumns 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?
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)
Are you using the Professional Edition of Visual Studio? It is likely that this feature is available only in the Premium or Ultimate editions.
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.
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 :).
精彩评论