How to convert smalldatetime to varchar? I've tried everything from http://msdn.microsoft.com/en-us/library/ms187928.aspx, but it didn't work.
I want to convert smalldatetime into varchar, because I want to use it in select like this:
select 'Some text'+@Date
thanks in advance
'121' is the format of the date in this case 'yyyy-mm-dd hh:mi:ss.mmm(24h)', char(16) is the number of characters you wish to include, first 16 in this case.
select 'Some text'+convert(char(16), @date, 121)
Cast and Convert
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With