%SQL Append null values into a SQL Table

Kody_Devl
New Contributor II

Hi All,

I am new to Databricks and am writing my first program.

Note: Code Shown Below:

I am creating a table with 3 columns to store data. 2 of the columns will be appended in from data that I have in another table.

When I run my append query into the empty table for 2 of the 3 fields, I get an error. I am assuming the the table is not allowing null values in the 3rd of 3 column/field.

Here is the error message:

"Column Member_cnt is not specified in INSERT."

If I add some value to the 3rd position, like" 2", the Append query works fine.

Here is my question:

How can a create a 3 column table that will accept, from an append query, data for only 2 of the 3 fields in the table (the third field gets updated later)?

My Code:

Create or Replace table MMR_Restated 

(

BID Varchar(20),

YearMo long,

Member_cnt integer);

This works (3of3)

INSERT INTO MMR_Restated

(BID, YearMo, Member_cnt)

Select Bid, YearMo, 22

From All_Bids_All_Periods;

This doesn't Work (2of3)

INSERT INTO MMR_Restated

(BID, YearMo)

Select Bid, YearMo

From All_Bids_All_Periods;

Many Thanks

Kody_Devl