SSIS SQL Task query adding Cross Join for no reason
I have the following UPDATE query:
UPDATE A
SET A.EARLY_SHIFT =
(SELECT DATEPART(hour, S.SCHED_START - A.FIRST_LOGIN) * 3600
+ DATEPART(minute, S.SCHED_START - A.FIRST_LOGIN) * 60
+ DATEPART(second, S.SCHED_START - A.FIRST_LOGIN) AS Expr1)
FROM DLY_AGT_ACTIVITY AS A
INNER JOIN DLY_AGT_SCHEDULES AS S
ON A.DATE = S.DATE AND RIGHT(A.ID, 5) = RIGHT(S._ID, 5)
This in Management studio runs perfectly. However, in my sql task of my SSIS package, it adds a CROSS JOIN like so:
UPDATE A
SET A.EARLY_SHIFT =
(SELECT DATEPART(hour, S.SCHED_START - A.FIRST_LOGIN) * 3600
+ DATEPART(minute, S.SCHED_START - A.FIRST_LOGIN) * 60
+ DATEPART(second, S.SCHED_START - A.FIRST_LOGIN) AS Expr1)
FROM DLY_AGT_ACTIVITY AS A
INNER JOIN DLY_AGT_SCHEDULES AS S
ON A.DATE = S.DATE AND RIGHT(A.ID, 5) = RIGHT(S._ID, 5) CROSS JOIN A
And this makes the query fail in my sql task. What the heck is g开发者_高级运维oing on?
*I have tried running without any aliases, and this did not help.
I have restructured your update query, but it should give the same result.
UPDATE DLY_AGT_ACTIVITY
SET EARLY_SHIFT = DATEPART(hour, S.SCHED_START - FIRST_LOGIN) * 3600
+ DATEPART(minute, S.SCHED_START - FIRST_LOGIN)
* 60 + DATEPART(second, S.SCHED_START - FIRST_LOGIN)
FROM DLY_AGT_SCHEDULES AS S
WHERE DLY_AGT_ACTIVITY.[DATE] = S.DATE
AND RIGHT(ID, 5) = RIGHT(S._ID, 5)
Can you try this in your package and let me know if it resolves the SSIS issue?
精彩评论