jai jai - 9 months ago 84
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)