Sunday, June 29, 2014

Conversion failed when converting the varchar value '5,6' to data type int.

Here is how you can find the culprit faster than Sherlock Holmes: Just comment out the suspect line.


What is the data type?



SELECT GGI.IID ID
, G.GrantNum
, PA.ProgramArea
, G.GranteeName
, G.Project
, L2.Description Race
FROM TGrant G
INNER JOIN TGrant_GranteeInfo GGI ON G.IID=GGI.GrantIID
left join TProgramArea PA on G.ProgramAreaIID=PA.IID
right join TLookup L2 on L2.Code=GGI.TargetRace_Codes and L2.FieldName='TargetRace'
WHERE G.GrantType='CSAT'
-- AND GGI.TargetRace_Codes IN (1,2,3,4,5,6,7)
ORDER BY PA.ProgramArea





Kalman Toth Database & OLAP Architect SQL Server 2014 Design & Programming

New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012















No comments:

Post a Comment