Sunday, February 19, 2012

How to get from smalldatetime -field only date?

Hi!
I'm using MSDE 2000 SP4. I need to get only date from smalldatetime
using SQL statement like "SELECT MyDate FROM MyTable.".
Like this way I'll get MyDate as "27.11.2005 0:00:00" when using finnish
regional settings, but how to get just "27.11.2005" without that empty time?
I think this is quite easy to solve.
Thanks in advance!
Mika
You have to use the CONVERT Function to dispaly it in the proper way:
Select CONVERT(VARCHAR(10),'27.11.2005 0:00:00',103)
HTH, jens Suessmeyer.
|||Jens kirjoitti:
> You have to use the CONVERT Function to dispaly it in the proper way:
> Select CONVERT(VARCHAR(10),'27.11.2005 0:00:00',103)
> HTH, jens Suessmeyer.
>
Nice, thanks Jens!
Is there a link where those different form numbers like 103 is
described? Looks like 104 is like finnish form of date, which I just
guessed.
|||Look int he BOL which is delivered within SQL Server or use the online
BOL:
http://msdn.microsoft.com/library/en...ca-co_2f3o.asp
HTH, Jens Suessmeyer.

No comments:

Post a Comment