Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mdanaci
Starting Member
2 Posts |
Posted - 2009-09-16 : 15:32:56
|
| Hi there;I have a primary key named pk, name and surname fields.I need to insert to my table names and surnames.INSERT INTO People (name,surname) VALUES ('john','black');I'm not giving pks database gives is auto. But my problem is i need to know the pk that my database gave. Because i have lots of dublicate records.Is there any way to retrieve pk while inserting to table.I hope you can understand me :( |
|
|
mdanaci
Starting Member
2 Posts |
Posted - 2009-09-16 : 16:20:49
|
| OK i solved the problem. I'm retrieving it with "SELECT @@IDENTITY" command. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
april198474
Starting Member
11 Posts |
Posted - 2009-09-21 : 23:27:10
|
quote: Originally posted by mdanaci Hi there;I have a primary key named pk, name and surname fields.I need to insert to my table names and surnames.INSERT INTO People (name,surname) VALUES ('john','black');I'm not giving pks database gives is auto. But my problem is i need to know the pk that my database gave. Because i have lots of dublicate records.Is there any way to retrieve pk while inserting to table.I hope you can understand me :(
that sounds good! |
 |
|
|
april198474
Starting Member
11 Posts |
Posted - 2009-09-22 : 00:47:22
|
| good!! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-22 : 03:45:50
|
quote: Originally posted by april198474 good!!--------------------------------aprilFree chat software for you
What is good?MadhivananFailing to plan is Planning to fail |
 |
|
|
JCirocco
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-09-23 : 08:29:02
|
| madhivanan, did you note all 5 posts (as of now) have the advertising tag line and their response makes no sense?John"The smoke monster is just the Others doing barbecue" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-09-23 : 09:01:36
|
quote: Originally posted by JCirocco madhivanan, did you note all 5 posts (as of now) have the advertising tag line and their response makes no sense?John"The smoke monster is just the Others doing barbecue"
Yes. I see now MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|