开发者

Convert date to NULL in SQL SEVER

开发者 https://www.devze.com 2023-01-31 06:54 出处:网络
I am interested in converting the dates to null in SQL server. Here is my simple query: SELECT ENTERED_DATE as DATE

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

0

精彩评论

暂无评论...
验证码 换一张
取 消