0

Can you tell me what is wrong with this query:

INSERT INTO properties  ( f_gen_id(NULL) , 'ASHAgroup18E' , entity , effective_dt , property_key , property_value , created_by , create_ts , updated_by , update_ts )  SELECT f_gen_id(NULL) , 'ASHAgroup18E' , entity , effective_dt , property_key , property_value , description , created_by , create_ts , updated_by , update_ts -- 'UIL-Migration', CURRENT_TIMESTAMP, 'UIL-Migration', CURRENT_TIMESTAMP  FROM properties WHERE group_key = 'ASHAgroup18B'; 
7
  • 3
    What makes you think there's something wrong with the query? Commented Nov 13, 2018 at 7:44
  • 1
    INSERT INTO tablename (column1, column2, ...) SELECT ..., i.e. spccify insert columns. Commented Nov 13, 2018 at 7:46
  • Also, what is f_gen_id(NULL)? Commented Nov 13, 2018 at 7:47
  • f_gen_id(NULL)?- this is idgen value we are marking as null Commented Nov 13, 2018 at 7:50
  • 3
    What DBMS are you using? Commented Nov 13, 2018 at 8:37

1 Answer 1

3

In the INSERT part you should have column names, not a function

INSERT INTO properties (f_gen_id(NULL),... 

replace this with the name of the primary key/id column

INSERT INTO properties (id,... 

Update I guess also the second column in the INSERT is incorrect since it contains a string. Again, replace it with a column name

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.