Convert date to NULL in SQL SEVER
I am interested in converting the dates to null in SQL server. Here is my simple query:
SELECT
ENTERED_DATE as DATE
ENTERED_DATE as NEXT_DATE
FROM SOMETABLE
开发者_如何学GoDATE 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
I would like my result something like this:
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)
How can I do this?
How about:
SELECT
ENTERED_DATE as DATE
CONVERT(datetime, NULL) as NEXT_DATE
FROM SOMETABLE
SELECT ENTERED_DATE as DATE, CAST(NULL AS DATETIME) as NEXT_DATE
FROM SOMETABLE
Not sure if I completely understand the question, can you do this?
SELECT ENTERED_DATE as DATE, NULL as NEXT_DATE FROM SOMETABLE
精彩评论