我有一个包含这样数据的表:
Date
-------
1900-01-01 00:00:00.000
1900-01-01 00:00:00.000
1900-01-01 00:00:00.000
2012-02-02 00:00:00.000
2012-02-03 00:00:00.000
1900-01-01 00:00:00.000
我需要一个查询,每当1900-01-01 00:00:00.000
出现时,我需要将检索列设为''
,其他值必须相同
Select case
When CONVERT(VARCHAR(10),app.LastActivityDate,101) = '1900-01-01' THEN ''
End as [Last Activity Date] from t_name
答案 0 :(得分:1)
请改为尝试:
Select case
When app.LastActivityDate = cast('19000101' as datetime)
THEN ''
ELSE CONVERT(VARCHAR(10),app.LastActivityDate,101)
End as [Last Activity Date] from t_name