1

I am trying to import from an old database into an updated one.

The databases are basically identical except in one of my tables I added a new column that is NOT NULL.

This obviously makes errors when I used the importer to move the rows over. Is there a way that I can define a default for this new NOT NULL field when doing an Import?

Jason
  • 11,435
  • 24
  • 77
  • 131

2 Answers2

2

Yes you can add a default constraint to the new column. See this post: Alter column, add default constraint

alter table TableName
add constraint df_ConstraintNAme
default > getutcdate() for [Date]

Community
  • 1
  • 1
Cory
  • 12,404
  • 7
  • 33
  • 28
0

Two options are:

1) Define a DEFAULT value constraint on the column

2) Temporarily make the column NULL, do the import, then reapply the NOT NULL constraint

Joe
  • 41,484
  • 20
  • 104
  • 125