Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 859007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:37:09+00:00 2026-05-15T08:37:09+00:00

I am testing out the new database project features of Visual Studio 2010 and

  • 0

I am testing out the new database project features of Visual Studio 2010 and want to change the name of a column in a table. I changed the name in the create script and deployed it against the database. The script that was generated just dropped the column and added a new column with the correct name, but all the data was lost.

Is there a setting that will not drop the column data?

I am looking for the “DataDude” solution to this issue. (If there is one)

PRINT N'Altering [dbo].[Users]...';

GO
ALTER TABLE [dbo].[Users] DROP COLUMN [TestX];

GO
ALTER TABLE [dbo].[Users]
    ADD [Testn] NVARCHAR (50) NULL;

GO

Thank you,
Keith

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:37:09+00:00Added an answer on May 15, 2026 at 8:37 am

    Use the Schema View by clicking View -> Database Schema View

    Expand the tables and its columns.

    Right click the column and click Refactor -> Rename…

    Change the name in the New Name field with Preview Changes box checked.

    Notice it changes not only the column name, but also the stored procedures that may be referencing that column.

    Inside the Database project a refactorlog file is created that shows the name change.

    When the new schema is deployed against the existing database, it appears that DataDude looks at the refactorlog file and the dbo._Refactorlog table to determine which refactors need to be processed against the database.

    Here is the code it generated using this procedure the change a column name that was also referenced in a stored procedure:

    EXECUTE sp_rename @objname = N'[dbo].[Users].[TestF]', @newname = N'TestG', @objtype = N'COLUMN';
    
    GO
    PRINT N'Altering [dbo].[ListUsers]...';
    
    GO
    ALTER PROCEDURE [dbo].[ListUsers]
    
    AS
        SELECT [ID], [FirstName], [LastName], [TestG]
        FROM Users
    RETURN 0
    GO
    

    Keith

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.