Reputation: 461
I have two identical tables bar one column, (one live, one test)
The test table has an extra not null Column called "MatchOrderNo"
I'm trying to extract data from Live to test, how can i populate this not Null for all rows?
basically my current statement is
INSERT INTO test SELECT * FROM live;
Upvotes: 0
Views: 33
Reputation: 40481
Depends what do you want to insert to the NOT NULL column? For a constant value :
INSERT INTO test
SELECT t.* , 'Val_For_NotNull_Col' FROM live t
Upvotes: 3
Reputation: 69440
You can use a Default value like:
INSERT INTO test SELECT live.col1, live.co2, '1' FROM live;
Upvotes: 1