SELECT id,
sageaccount,
sageid,
totalwithoutvat,
vat,
total,
invoicedate,
alloweditting,
finished,
CASE WHEN isposted = 1 THEN 'Posted on ' + posteddate
ELSE 'Not Posted'
END AS Posted
FROM Invoices
WHERE (sageaccount = @sageaccount)
If I take the ‘+ posteddate’ away, it works perfectly. But with the + posteddate, I get this error:
Conversion failed when converting datetime from character string.
The posteddate field is usually null, unless posted is true, and the format of posteddate is definetly datetime.
Any ideas?
You need to convert posteddate to a varchar value in order to concatenate it with another varchar value (‘Posted on ‘)