我在 Vectorwise DB 中有一个查询,
UPDATE current_load_details cld
FROM date_dim dd
SET current_date_sk = dd.date_sk
,batchstring = date_part('YEAR', dd.dateval) || CASE
WHEN length(date_part('MONTH', dd.dateval)) = 1
THEN '0' || date_part('MONTH', dd.dateval)
ELSE date_part('MONTH', dd.dateval)
END || CASE
WHEN length(date_part('DAY', dd.dateval)) = 1
THEN '0' || date_part('DAY', dd.dateval)
ELSE date_part('DAY', dd.dateval)
END
,is_last_run_successful = 0
WHERE cld.load_date = dd.dateval
我需要将它迁移到 SQLSERVER,我已经尝试过了,
UPDATE cld.current_load_details
FROM dd1.date_dim
SET current_date_sk = dd1.date_sk
,batchstring = datepart(yyyy, dd1.dateval) OR CASE
WHEN length(datepart(mm, dd1.dateval)) = 1
THEN '0' OR datepart(mm, dd.dateval)
ELSE datepart(mm, dd1.dateval)
END OR CASE
WHEN length(datepart(dd, dd1.dateval)) = 1
THEN '0' OR datepart(dd1, dd.dateval)
ELSE datepart(dd, dd1.dateval)
END
,is_last_run_successful = 0
WHERE cld.load_date = dd1.dateval
它仍然给出错误。请帮助。