Jump to content

sql server how to have multiple registration with the same primary key?

shooter2749

INSERT INTO tblLocDetail(NumLoc, NumExemp, DateRetour, Qte, PrixLoc, PointsBonis, PenEx)

VALUES

(1, 'hpd01', '2004-04-01', 1, 4, 0, 0),

(2, 'hpd02', '2004-04-01', 1, 4, 0, 0),

(2, 'exb01', '2004-04-01', 1, 5, 0, 0),

(3, 'exd01', '2004-03-25', 1, 5, 0, 0),

(4, 'hpb03', '2004-04-01', 1, 4, 0, 0)

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, shooter2749 said:

INSERT INTO tblLocDetail(NumLoc, NumExemp, DateRetour, Qte, PrixLoc, PointsBonis, PenEx)

VALUES

(1, 'hpd01', '2004-04-01', 1, 4, 0, 0),

(2, 'hpd02', '2004-04-01', 1, 4, 0, 0),

(2, 'exb01', '2004-04-01', 1, 5, 0, 0),

(3, 'exd01', '2004-03-25', 1, 5, 0, 0),

(4, 'hpb03', '2004-04-01', 1, 4, 0, 0)

NumLoc is my primary key

Link to comment
Share on other sites

Link to post
Share on other sites

It defeats the purporse of primary key. You can remove a unique constraint on the column and insert rows with identity insert on, but I'm not going to tell you how to do it. It would hurt me.

Try, fail, learn, repeat...

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×