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 |
|
joemama
Posting Yak Master
113 Posts |
Posted - 2005-04-03 : 20:43:21
|
| in database designer i am trying to create a foreign key from userID in Users to UserID in Newsletter and i get this error...'Users' table saved successfully'Newsletter' table- Unable to create relationship 'FK_Newsletter_Users'. ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint 'FK_Newsletter_Users'. The conflict occurred in database 'rsensations', table 'Users', column 'UserID'.any clue? |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-04-03 : 20:47:11
|
| You have data in the table which doesn't have corresponding data in the referenced table.tryselect distinct n.UserIDfrom Newsletter nleft join Users uon u.UserID = n.UserIDwhere u.UserID is nullThat will give all the entries that violate the fk.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
joemama
Posting Yak Master
113 Posts |
Posted - 2005-04-03 : 23:46:59
|
that did it...thannks!quote: Originally posted by nr You have data in the table which doesn't have corresponding data in the referenced table.tryselect distinct n.UserIDfrom Newsletter nleft join Users uon u.UserID = n.UserIDwhere u.UserID is nullThat will give all the entries that violate the fk.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy.
|
 |
|
|
|
|
|