The following is a section of my select statement
CAST(Table.field AS datetime) AS newDate
As you would expect, it returns something like the following
1/1/1900 2:45:00 PM
However, I need it to return that same value inside single quotes as seen below. But I am having a really hard time for the syntax of this, with a cast statement, with a column renaming. Hopefully you guys could be of some help?
'1/1/1900 2:45:00 PM'
Cast the value to a varchar and concatenate them:
You might want to investigate
convertto have better control over the format of the resulting date.That used the SQL Server method for concatenation. In other databases, you might use
||or the functionconcat.