jai jai - 7 months ago 67
SQL Question

Converting datetime variable format

I need help in converting a DateTime variable with format mmm dd yyyy
to a Datetime variable with format yyyy-mm-dd


I'm assuming your datetime variable is a VARCHAR - this can be directly cast via CONVERT:

Declare @YourVariable Varchar (15) = 'JAN 01 1996'

Select Convert(Date, @YourVariable)