sql server 2008 - sql combining two columns one of which is a datetime -
i have following sql code (ms sql server 2008)
select (analysisno + ' ' + '-' + ' ' + description + ' ' + '-' + ' ' + formdate) columna
from old_analysis_data order formdate
i following error conversion failed when converting date and/or time character string.
analysisno varchar(10) description varchar(500) formdate datetime (not table, old one)
any ideas, cant find answer on google.
convert time string using convert before concatenation:
select ( analysisno + ' ' + '-' + ' ' + description + ' ' + '-' + ' ' + convert(varchar(20), formdate, 100) ) columna old_analysis_data order formdate
in case, 100 style sets datestamp format mon dd yyyy hh:miam (or pm) example