我无法将getdate()分配给TT.EFFECTIVE_EDATE?
UPDATE
[XXXXX]
SET
TT.EFFECTIVE_EDATE = getdate(),
TT.CURRENT_FLAG = 'N'
FROM
[XXXXX] AS TT
INNER JOIN [YYYYY] AS TB
ON TT.A = TB.A
AND TT.B = TB.B
WHERE
substring(TB.F,13,8) > substring(TT.F,13,8)
在运行时,我收到以下错误:
多部分标识符" TT.EFFECTIVE_EDATE"无法受约束。
答案 0 :(得分:1)
试试这个:
UPDATE
TT
SET
EFFECTIVE_EDATE = getdate(),
CURRENT_FLAG = 'N'
FROM
[XXXXX] AS TT
INNER JOIN [YYYYY] AS TB
ON TT.A = TB.A
AND TT.B = TB.B
WHERE
substring(TB.F,13,8) > substring(TT.F,13,8)
答案 1 :(得分:1)
您应该在update语句中使用您为此表提供的别名,请尝试以下操作:
UPDATE TT
SET
TT.EFFECTIVE_EDATE = getdate(),
TT.CURRENT_FLAG = 'N'
FROM
[XXXXX] AS TT
INNER JOIN [YYYYY] AS TB
ON TT.A = TB.A
AND TT.B = TB.B
WHERE
substring(TB.F,13,8) > substring(TT.F,13,8)