25 pts.
 Insert Multiple rows
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

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question. Michael Tidmarsh   11,410 pts. , iceruam   25 pts. , reme75   15 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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!

 44,220 pts.