我正在处理从一个数据库到另一个数据库的数据迁移。
到目前为止,一切正常,但在一张桌子上我总是遇到同样的错误。我也想在这个表中迁移的外键有问题。我想我必须为外键声明一些特殊的东西?
这是我的查询:
INSERT INTO [asd].HolidayTracker.dbo.AnnualVacation(UserId,WorkingTime,VacationDays,FromDate,ToDate)
SELECT u1.user_htUserId,
u1.vacationDays,
u1.workingTime,
CAST('2013-01-01' AS DATETIME),
CAST('2013-12-31' AS DATETIME)
FROM HolidayTracker.dbo.AnnualVacation u1
LEFT JOIN [asd].HolidayTracker.dbo.AnnualVacation u2
ON u1.user_htUserId = u2.UserId AND
u1.vacationDays = u2.VacationDays AND
u1.workingTime = u2.WorkingTime
这是我收到的错误消息:
error message INSERT INTO [asd].HolidayTracker.dbo.AnnualVacation(UserId,WorkingTime,VacationDays,FromDate,ToDate) – `
这是表结构:源表
目标表