Null Fields to Not Null Fields with Inserts

aperregatturvaperregatturv Posts: 67
edited April 6, 2006 6:35PM in SQL Toolkit Previous Versions
Hi

I have a table on a older database which has
Table 1
Field1 int Not Null
Field2 varchar(50) Not Null
Field3 DateTime
with 3 records.

After updating
Table 1
Field1 int Not Null
Field2 varchar(50) Not Null
Field3 DateTime
Field4 int Not Null (new field)

My problem is when i reinsert the old 3 records using SQL Toolkit I get an error unable to insert Null because Field4 is Not Null.
How do I fix this.
I am testing SQL ToolKit 4
//*********** this is the code i use
RedGate.SQLCompare.Engine.Database db1 = new RedGate.SQLCompare.Engine.Database();
RedGate.SQLCompare.Engine.Database db2 = new RedGate.SQLCompare.Engine.Database();
db1.Register(new ConnectionProperties(this.cmbBxServer1.Text, this.txtBxDB1.Text,"abc","abc"), Options.Default);
db2.Register(new ConnectionProperties(this.cmbBxServer2.Text, this.txtBxDB2.Text,"abc","abc"), Options.Default);
Differences diffs = db1.CompareWith(db2, Options.Default);
foreach (Difference diff in diffs)
{
if (diff.Type.ToString() == "Different")
{
diff.Selected = true;
}
}
Work wrk = new Work();
wrk.BuildFromDifferences(diffs, Options.Default, true);
ExecutionBlock block = wrk.ExecutionBlock;
RedGate.SQL.Shared.BlockExecutor b = new BlockExecutor();
b.ExecuteBlock(block, this.cmbBxServer2.Text, this.txtBxDB2.Text,false,"abc","abc");
MessageBox.Show(this.txtBxDB2.Text + " successfully updated");
block.Dispose();
db1.Dispose();
db2.Dispose();
//*********************

Comments

Sign In or Register to comment.