0

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 into Table (COLA,COLB,COLC,COLD) values (1,2,'','')?

I know I can't insert into computed columns. But how can I add a row and keep the default computed columns as they are?

Thanks for any advice!

user3344443
  • 475
  • 2
  • 11
  • 29

4 Answers4

5

try this

    INSERT INTO TABLE (COLA,COLB) values (1,2);

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

sonique
  • 4,539
  • 2
  • 30
  • 39
Avinash patil
  • 1,689
  • 4
  • 17
  • 39
1

Just specify the columns you want to insert values into:

insert into Table (COLA,COLB) values (1,2)
Stuart Ainsworth
  • 12,792
  • 41
  • 46
1

Just don't specify the calculated columns:

insert into Table (COLA,COLB) values (1,2)
Philip Kelley
  • 39,426
  • 11
  • 57
  • 92
0

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.

user3344443
  • 475
  • 2
  • 11
  • 29