Is there any way that I can convert the DateTime SQL value of this:
2011-10-11 00:00:00.000
to a string formatted exactly the same?
'2011-10-11 00:00:00.000'
I tried doing cast(fl_from_dt as varchar(50) but it converts it to something readable – ex. 'Oct 11 2011 12:00AM'
Are you using SqlServer?
Take a look at the
styleparameter ofCONVERT()here: http://msdn.microsoft.com/en-us/library/ms187928.aspx – in particular have a look at the ODBC canonical (with milliseconds) format.For short you should use
style121 in theCONVERT()command.