here's my code:
DECLARE @SQL varchar(600)
SET @SQL =
'SELECT CategoryID, SubCategoryID, ReportedNumber
FROM tblStatistics
WHERE UnitCode = ' + @unitCode +
' AND FiscYear = ' + @currYEAR
EXEC (@SQL)
When i run this sproc with unitCode = 'COB' and currYEAR = '10', i get the following error:
Invalid column name 'COB'.
Does anyone know why?
thx!