jai jai - 1 year ago 158
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

Answer Source

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)


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download