convert(datetime, BIRTH_MM + '/' + BIRTH_DD + '/' + BIRTH_YY, 103) as Birthdate
所以连接的字符串如下所示:04/05/88
试图让这个工作。
试过这个,关闭我现在得到一个日期,但它给了我 1900 年或 1905 年,这是不对的
convert(datetime, BIRTH_MM + BIRTH_DD + BIRTH_YY, 103) as Birthdate
更新
尝试了一些东西,但还没有:
case when(BIRTH_DD > 0 and BIRTH_MM > 0 and BIRTH_YY > 0)
then
convert(datetime, cast(BIRTH_DD as varchar(1)) + '/' + cast(_BIRTH_MM as varchar(2)) + '/' + cast(BIRTH_YY as varchar(4)), 103)
else
convert(datetime, '1900-01-01', 103) as Birthdate,
end