Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting a Record Many Times 1

Status
Not open for further replies.

szaunbr

Technical User
Jul 5, 2006
50
0
0
US
Hello.

I have a one table that contains pay type records for all of my employees. I would like to add one pay type to every employee but am not sure how.

I tried this:

INSERT INTO premppay (prep_emp, prep_pay) VALUES (6569, 759)

but that only inserts the record into one employee (ee# 6569).

How would I add pay type 759 to all employees.

I thought about this:

INSERT INTO premppay (prep_pay) VALUES (759)

but am leery of trying this until I get some more feedback.

Thanks in advance.
 
INSERT INTO premppay (prep_emp, prep_pay) SELECT emp_id, 759 FROM empoyee

if "employee" is the table with the eployee and emp_id is the id
 
OK.
I tried that and I got an error:

Could not insert new row - duplicate value in a UNIQUE INDEX column.

Not sure what that means.
 
this means you have an unique constraint on table premppay, which is not correct (from your message, I can't guess what it is)
or you have correct unique constraint, but duplicated emp_ids are comming from employee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top