Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to place a empty datetime in a Select?
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00436393
Message ID:
00436424
Views:
24
>I need to blank a datetime field in a select. What is the syntax?
>
>Ex:
>
>Select *,
>       case
>           When MyFlag = 1
>           then MyDateTime
>           else { / / } <b> ???</B>
>       end as MyNewDateTime
>       from MyTable
>



SQL SErver doesn't have blank date.
You can put empty string after 'else' but SQL Server will return '01/01/1900 00:00:00' as result. I guess it's it default for blank date.
Also you can use NULL to represent blank value. It depends on how you are going to use result of above SQL statement.

HTH
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform