Skip to content Skip to sidebar Skip to footer

Sql Insert Into A Table With Computed Columns

I have a table with 4 columns, say COLA,COLB,COLC,COLD. COLC and COLD are computed columns. Suppose I want to insert a row into table, should the query be something like insert int

Solution 1:

try this

INSERTINTOTABLE (COLA,COLB) values (1,2);

you dont need to provide the values even blanks for computed column. They get calculated automatically

Solution 2:

Just specify the columns you want to insert values into:

insertintoTable (COLA,COLB) values (1,2)

Solution 3:

Just don't specify the calculated columns:

insertintoTable (COLA,COLB) values (1,2)

Solution 4:

Thank you all! I just got that out too! Previously I got errors that number of col don't match, because I missed a a column.

Post a Comment for "Sql Insert Into A Table With Computed Columns"