I have several hundred records to insert into a database
My issue is
only one column is variable, that is for example
Column1 will always be the same, column2 will change, and the remain columns will also be repeated with one caveat, there is an auto generated field in the mix I need to skip.
Date |ID |Key Field | State|County|.......
Same|variable|Auto Generated| Same|Same|.............
I am not sure how to create the insert statement
Software/Hardware used:
Postgresql
ASKED:
July 25, 2012 1:56 PM
UPDATED:
July 26, 2012 6:15 PM
not up on PostgreSQL but assuming that it resembles other SQL’s and that you have the one column that you need is a file.
Insert into lists the columns in the target except that auto increment column .. it takes care of itself (Third Column in this example).
INSERT INTO MyTarget (FirstCol, SecondCol, Fourth Col)
Select ‘Constant 1′, ‘Constant 2′, FieldFromSource
From MySource
Enjoy!