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 |
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-06-20 : 06:00:01
|
i am trying to doinsert into table1(idnumber)select idnumber from tableZZZ left outer join table1on tableZZZ.idnumber=table1.idnumberwhere table1.idnumber is null which meand to add to a table idnumber which it dosnet havebu i am reciving all the time PRIMARIY KEY VIOLATION where i insert new keys that dosent exist-where can be the problem?thnaks in advancepelegIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-06-20 : 06:12:59
|
I'm not sure this is relevant, but does that sql not give you an "Ambiguous column name 'idnumber'." error?insert into table1(idnumber)select tableZZZ.idnumber from tableZZZ left outer join table1on tableZZZ.idnumber=table1.idnumberwhere table1.idnumber is null Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-06-20 : 06:15:41
|
| i did tableZZZ.idnumber just forgot to type it hereand not i get a message that "cannot insert duplicate Key in object table1"Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
 |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-06-20 : 06:37:37
|
| foudn the problem in th e source table the idnumber was twiceIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-20 : 06:53:57
|
quote: Originally posted by pelegk2 foudn the problem in th e source table the idnumber was twiceIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
In that case use DistinctMadhivananFailing to plan is Planning to fail |
 |
|
|
pelegk2
Aged Yak Warrior
723 Posts |
Posted - 2006-06-20 : 08:06:52
|
| nope what i did is that i wentto the source table and made a query to check all idnumberthat appers morethen onceIsrael -the best place to live in aftr heaven 9but no one wan't to go there so fast -:) |
 |
|
|
|
|
|