Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to place a empty datetime in a Select?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00436393
Message ID:
00436424
Vues:
25
>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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform