Tuesday, March 27, 2012

convert a datatype

i have table tt.
it contains two fields one is ttno int,doj datetime . i want to
convert to datetime to varchar .
how it is ... give me some examplesNo problem, look at the CONVERT function for a specific format you want
to extract. I prefer using the ISO one, though its good for ordering
and international.

CONVERT(VARCHAR(10),GETDATE(),112)

HTH, jens Suessmeyer.

--
http://www.sqlserver2005.de
--|||Check the topic CONVERT in SQL Server Books Online.

--
Anith|||Anith Sen (anith@.bizdatasolutions.com) writes:
> Check the topic CONVERT in SQL Server Books Online.

Actually, the topic is CAST and CONVERT, lest someone looks in the wrong
place and don't find it.

--
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