What T-SQL command that will alter the column so that it is now Varchar '03-26-2006'?
I also want to know how to do the opposite... if I have '03-26-2006' via command, how do I convert the column of the table to be datetime from varchar
This should give you an idea of how to handle these conversions:
DECLARE @.MyDateTimeValue datetime
SET @.MyDateTimeValue = '2006-03-26 00:00:00.000'
SELECT convert( varchar(10), @.MyDateTimeValue, 101 )
-
03/26/2006
SELECT cast( '03/26/2006' AS datetime )
2006-03-26 00:00:00.000
No comments:
Post a Comment