What are the challenges you face when working across database platforms? Take the survey

Non-null field in Source DB added to Dest DB

Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
edited April 4, 2005 4:23AM in SQL Compare Previous Versions

Thanks for writing. We're looking into possible fixes for this. If the column is a new column, it works to specify a default value for the new column, that way the new column's rows of data will be filled-in so that they do not violate the NOT NULL constraint.

The problem still lies with existing data -- we'll see what we can do, but for now you'll need to identify these rows and run a SQL query where the old column IS NULL and replace those values with something.


  • Options
    but really this comes down to database design...

    you can't realistically expect to add a new column, which doesnt allow NULLS to a live production database table which already contains data in it! In this case you should either set a default value on the column (wiull then be included in the creation script), or add it first allowing NULL, then run a script to set the values to something appropriate, and then set the NOT NULL property once every existing record has a not NULL value.
This discussion has been closed.