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 8291811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:15:33+00:00 2026-06-08T13:15:33+00:00

I am starting to use database-projects and struggling with simple tasks. If I would

  • 0

I am starting to use database-projects and struggling with simple tasks. If I would like to add a new column which is NOT NULL, how can I make it work if there is already data in the table?

I used to write diff-scripts, in such a case I would have written something like:

-- ... ADD COLUMN X ... 
-- insert data into x
-- ... ALTER COLUMN X NOT NULL

How would I need to handle such cases with a database-project?

Thx for any tipps
sl3dg3

  • 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-06-08T13:15:35+00:00Added an answer on June 8, 2026 at 1:15 pm

    I found finally two possible ways. In a nutshell:

    • Use a default-constraint (as suggested by Rain)
    • Fill the data in the post-deployment script, drop the default-constraint
    • After deployment, remove the default-constraint from the source

    Or

    • Backup the table’s data in the pre-deployment script into a temporary table, delete data from the target table
    • In the post-deployment script, move the data back into the target table, including the new data for the new NOT NULL – column, drop the table

    Found here: http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/49bf2a88-d80d-4a9f-970e-728bd530332e/

    Or here: http://blogs.msdn.com/b/bahill/archive/2009/03/30/managing-data-motion-during-your-deployments-part-1.aspx

    Both means extra work, I was hoping for more support from the framework for such common cases. But at least it can be done like that.

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

Sidebar

Related Questions

I am just starting to use Wix and would like to use heat to
I'm starting a new project soon and I'd like to try to use some
I am starting to use some Java code which was written by someone else.
i'm just starting to use asp.net mvc.. since i'm not familiar with it, i
When starting a new project that required the use of membership providers I found
I'm starting a new C# project that uses a database, but I want it
I am starting a simple windows forms application that requires a database to store
So, I am just starting to use jQuery with one of my Django projects,
I am starting a new project using WCF so that I can use jQuery
I'm just starting to use Hibernate and I was wondering how to insert a

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.