Heey guys I'm have some strange trouble's that I don't know why they appear .To simplify my problem I just want to merge values from tow tables together so this is not a hard task but I have a FOREIGN KEY that is make some trouble with this key I can see which user has added some vacation (Nothing special a normal task of a FOREIGN KEY ) and I want to give this FOREIGN key the values of the old one but somehow this is not working there is always the same error message The INSERT statement conflicted with the FOREIGN KEY constraint "FK_AnnualVacation_HtUser1". The conflict occurred in database "HolidayTracker", table "dbo.HtUser", column 'UserId'.My query INSERT INTO [ch-s-0008180].HolidayTracker.dbo.AnnualVacation(UserId,FromDate,ToDate,WorkingTime,VacationDays) SELECT u1.user_htUserId , CAST('2013-01-01' AS DATETIME), CAST('2013-12-31' AS DATETIME), u1.vacationDays, u1.workingTime FROM HolidayTracker.dbo.AnnualVacation u1 LEFT JOIN [ch-s-0008180].HolidayTracker.dbo.AnnualVacation u2 ON u1.user_htUserId = u2.UserId AND u1.workingTime = u2.workingTime AND u1.vacationDays = u2.vacationDays
Thanks for help and fast answer !!