PDA

View Full Version : sql help?


maidos
10-10-2010, 07:07 PM
if anyone can help how to avoid dublicated primary key if the salary is different but the primary key=company name is the same?
or can anyone recommend me other site i can ask

an example is this Pulsen is the primary key

VALUES('Pulsen',
'Projektledare',
CONVERT(DATETIME, '2010-10-05 00:00:00.000', 121),
CONVERT(DATETIME, '2010-12-24 00:00:00.000', 121),
'Projektledare',
'30000')

VALUES('Pulsen',
'IT-arkitekt',
CONVERT(DATETIME, '2010-11-15 00:00:00.000', 121),
CONVERT(DATETIME, '2011-02-01 00:00:00.000', 121),
'Systemarkitekt',
'25000')

kh99
10-10-2010, 08:05 PM
It seems like the solution would be to change the primary key (or maybe create a new table for the salary records), but I'm not a database expert so I can't tell you.

BirdOPrey5
10-11-2010, 02:51 AM
If it's a primary key it can't be duplicate, it must be unique- that is part of the definition of a 'primary key.'