When I run this I get on the bold part belowConversion failed when converting the varchar value 'Area 1' to data type int.SELECT '' AS reg, RegionAcronym, RegionAcronym AS area , SUM(totpenfodds) AS 'totpenfodds', SUM(pendinfo) AS 'pendinfo', SUM(pendndds) AS 'pendndds', SUM(pendndds1) AS 'pendndds1', SUM(pendfo300) AS 'pendfo300', SUM(penddds300) AS 'penddds300', SUM(pend250) AS 'pend250', SUM(pend300) AS 'pend300', SUM(pend351) AS 'pend351', SUM(pend400) AS 'pend400'FROM T16Report where reg='c'group by reg, RegionAcronymunionselect '' as reg, RegionAcronym, Area,'Area ' + right (area,1), SUM(totpenfodds) AS 'totpenfodds', SUM(pendndds) AS 'pendndds', SUM(totpenfodds - pendndds) AS pendinfo, SUM(pendfo300) AS 'pendfo300', SUM(penddds300) AS 'penddds300', SUM(pend250) AS 'pend250', SUM(pend300) AS 'pend300', SUM(pend351) AS 'pend351', SUM(pend400) AS 'pend400'FROM T16Report where reg='c' and area='01'group by reg, RegionAcronym, area
The first query gives me this:Reg RegionAcronym Area Totpenfodds etc... PHI PHI 69633 The Second query gives me this: Reg RegionAcronym Area no column name totpenfodds etc... PHI 01 Area 1 13896
It's having problems with the Area 1 name. I don't know how to cast or covert this: 'Area ' + right (area,1). How do I do that?