废话不多说,直接上sql:
UPDATE db_huanjing_GM_YanQing_TEST.dbo.GM_AY_yiqi_copy
SET jiandingriqi = concat (
Datepart(
yyyy,
CAST (
jiandingriqi AS datetime
)
),
IIF (
Datepart(
mm,
CAST (
jiandingriqi AS datetime
)
) > 9,
concat (
'年',
Datepart(
mm,
CAST (
jiandingriqi AS datetime
)
)
),
concat (
'年0',
Datepart(
mm,
CAST (
jiandingriqi AS datetime
)
)
)
),
IIF (
Datepart(
dd,
CAST (
jiandingriqi AS datetime
)
) > 9,
concat (
'月',
Datepart(
dd,
CAST (
jiandingriqi AS datetime
)
)
),
concat (
'月0',
Datepart(
dd,
CAST (
jiandingriqi AS datetime
)
)
)
),
'日'
) where jiandingriqi != '';