我有兴趣在SQL Server中将日期转换为null。这是我的简单查询:
SELECT
ENTERED_DATE as DATE
ENTERED_DATE as NEXT_DATE
FROM SOMETABLE
DATE NEXT_DATE
12/1/2010 12:30:00 AM 12/1/2010 12:30:00 AM
12/1/2010 4:00:00 AM 12/1/2010 4:00:00 AM
12/1/2010 9:00:00 AM 12/1/2010 9:00:00 AM
我希望我的结果是这样的:
DATE NEXT_DATE
12/1/2010 12:30:00 AM (null)
12/1/2010 4:00:00 AM (null)
12/1/2010 9:00:00 AM (null)
我想知道是否有人可以帮我解决问题。非常感谢提前。
答案 0 :(得分:4)
怎么样:
SELECT
ENTERED_DATE as DATE
CONVERT(datetime, NULL) as NEXT_DATE
FROM SOMETABLE
答案 1 :(得分:3)
SELECT ENTERED_DATE as DATE, CAST(NULL AS DATETIME) as NEXT_DATE
FROM SOMETABLE
答案 2 :(得分:0)
不确定我是否完全理解这个问题,你能做到吗?
SELECT ENTERED_DATE为DATE,NULL为NEXT_DATE FROM SOMETABLE