I keep on getting the error;
Conversion failed when converting the varchar value '* ' to data type int.
after running this query below. Can someone explain why?
USE doleta
DECLARE @EER_BEGIN CHAR(8);
SET @EER_BEGIN = '20130701';
DECLARE @EER_END CHAR(8);
SET @EER_END = '20140630'; --2 qtr rate and median earnings
SELECT xqtr, COUNT (Appid) AS Exiters
,SUM(CASE WHEN (ExitWages2>0 or ExitEmployed2='1') THEN 1 ELSE 0 END) AS Q2ER
--,SUM(CASE WHEN (ExitWages3>0 or ExitEmployed3='1') THEN 1 ELSE 0 END) AS Q3ER
,SUM(CASE WHEN gender='1' THEN 1 ELSE 0 END) AS GenderM
,sum(case when gender='2' THEN 1 else 0 end) as GenderF
,SUM(CASE WHEN (age between 26 and 35) THEN 1 ELSE 0 END) AS Age2635
,sum(case when (age between 36 and 45) then 1 else 0 end) as Age3645
,sum(case when (age between 46 and 55) then 1 else 0 end) as Age4655
,sum(case when (age between 56 and 65) then 1 else 0 end) as Age5665
,sum(case when age>=66 then 1 else 0 end) as Age66
,SUM(CASE WHEN Hispanic='1' THEN 1 ELSE 0 END) AS RaceHisp
,SUM(CASE WHEN Asian='1' THEN 1 ELSE 0 END) AS RaceAsian
,SUM(CASE WHEN Black='1' THEN 1 ELSE 0 END) AS RaceBlack
,SUM(CASE WHEN PacificIslander='1' THEN 1 ELSE 0 END) AS RaceHPI
,SUM(CASE WHEN NativeAmerican='1' THEN 1 ELSE 0 END) AS RaceAI
,SUM(CASE WHEN White='1' THEN 1 ELSE 0 END) AS RaceWht
,SUM(CASE WHEN MultiRace='1' THEN 1 ELSE 0 END) AS RaceMult
,SUM(CASE WHEN (HighestGradeCompleted in ('87','88')) THEN 1 ELSE 0 END) AS hsdropout
,SUM(CASE WHEN HighestGradeCompleted in ('13','14','15')THEN 1 ELSE 0 END) AS collegedropout
,SUM(CASE WHEN HighestGradeCompleted between '00' and '12' THEN 1 ELSE 0 END) AS hsgrad
,SUM(CASE WHEN HighestGradeCompleted='90' THEN 1 ELSE 0 END) AS certotherps
,SUM(CASE WHEN HighestGradeCompleted='91' THEN 1 ELSE 0 END) AS asoc
,SUM(CASE WHEN HighestGradeCompleted='16' THEN 1 ELSE 0 END) AS ba
,SUM(CASE WHEN HighestGradeCompleted='16' THEN 1 ELSE 0 END) AS ma
,SUM(CASE WHEN Vet='1' THEN 1 ELSE 0 END) AS Veteran
,SUM(CASE WHEN (PriorWages2>0 and PriorWages3>0) THEN 1 ELSE 0 END) AS WageP3P2
,SUM(CASE WHEN (PriorWages3>0)THEN 1 ELSE 0 END) AS WageP3
,SUM(CASE WHEN (PriorWages2>0)THEN 1 ELSE 0 END) AS WageP2
FROM dbo.wp_9002_20144_a
WHERE ProgramExitDate BETWEEN @EER_BEGIN AND @EER_END
--and (ExitWgeQtr2>0)
--AND rgn BETWEEN '01' AND '24'
GROUP BY xqtr
ORDER BY xqtr;