select packageid,status+' Date : '+UpdatedOn from [Shipment_Package]
The below error is appeared when executing the above code in sql server. The type of UpdatedOn
is DateTime
and status is a varchar
. We wanted to concatenate the status, Date and UpdatedOn.
error:
Conversion failed when converting date and/or time from character string.
Convert Datetime column into varchar for sql Server you can use below code
select packageid,status+' Date : '+CONVERT(VARCHAR,UpdatedOn,120) from [Shipment_Package]
120 code will convert your date into this format : 2020-06-12 15:09:00 other format you can use from this link
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