October 14, 2008 at 10:26 pm
i have a column called DOB(datatype :datetime) in my table A which as values like as follows
DOB
1925-12-19 00:00:00.000
1935-04-10 00:00:00.000
1929-08-19 00:00:00.000
I WANT IT TO UPDATE IT WITH VALUES AS FOLLOWS for that column in my table
12/19/1925
04/10/1935
08/19/1929
October 14, 2008 at 10:44 pm
Best (10/14/2008)
i have a column called DOB(datatype :datetime) in my table A which as values like as followsDOB
1925-12-19 00:00:00.000
1935-04-10 00:00:00.000
1929-08-19 00:00:00.000
I WANT IT TO UPDATE IT WITH VALUES AS FOLLOWS for that column in my table
12/19/1925
04/10/1935
08/19/1929
No, you really don't. Dates have a huge number of uses even for things as simple as a DOB. But you won't be able to do any of them if you format a date like that because you'll need to store it as a VARCHAR. Use CONVERT to display it any way you want, but don't store it as anything other than a datetime. Lookup CONVERT in Books Online to see how the following works...
SELECT CONVERT(CHAR(10),DOB,101)
FROM yourtable
--Jeff Moden
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply