February 6, 2005 at 2:29 pm
ALTER TABLE [dbo].[Enrollment] ADD
CONSTRAINT [ClassStudentMap2Enrollment] FOREIGN KEY
(
[CSMid]
  REFERENCES [dbo].[ClassStudentMap] (
[CSMid]
  ON DELETE CASCADE
GO
Server: Msg 547, Level 16, State 1, Line 1
ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint 'ClassStudentMap2Enrollment'. The conflict occurred in database 'Schoolwise', table 'ClassStudentMap', column 'CSMid'.
What's going on here? My brain is on strike. I dropped this table, created it again using a SELECT INTO from tmp_Enrollment and tried to recreate the constraints, indexes etc from a backup script of Enrollment. Everything went well apart from the above code.
Thanks.
February 6, 2005 at 2:33 pm
Have you checked for invalid data that may make the foreign key fail (maybe some data has been deleted in the parent table in between data transfers)?
February 6, 2005 at 2:39 pm
You little beauty - that was it - my brain was on strike
Thanks for the speedy reply - very much appreciated indeed.
Regards.
February 6, 2005 at 3:36 pm
I wouldn't go as far as say little, but I'll take the beauty part of the compliment .
HTH.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply