Tuesday, February 14, 2012

Convert from datetime to varchar

I am trying to convert datetime to varchar.

>From my memory (I am not 100% sure), datetime data is like "Nov 15,
2005" and
varchar data is like "2005-11-15."
Any feedback or help would be appreciated.
Thanks.(justin_doh@.yahoo.com) writes:
> I am trying to convert datetime to varchar.
>
> 2005" and
> varchar data is like "2005-11-15."
>
Datetime is stored in a binary format in SQL Server.
You can use the convert() function to convert datetime to a string.
There are a number of format codes to choose from. Look up the topic
CAST and CONVERT in Books Online.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

No comments:

Post a Comment