没测试 你试下
CAST(Year(日期) AS VARCHAR(10)) +
CASE WHEN LEN(CAST(MONTH(日期) AS VARCHAR(10)))<2
THEN '0' + CAST(MONTH(日期) AS VARCHAR(10))
ELSE CAST(MONTH(日期) AS VARCHAR(10))
END
+
CASE WHEN LEN(CAST(DAY(日期) AS VARCHAR(10)))<2
THEN '0' + CAST(DAY(日期) AS VARCHAR(10))
ELSE CAST(DAY(日期) AS VARCHAR(10))
END