Arithmetic overflow error converting nvarchar to data type numeric.select name, tipo = case when [type] = 'Institution' OR [type] = 'Park' OR [type] = 'Marina' OR [type] = 'Museum' OR [type] = 'Stadium or Arena' OR [type] = 'Popular Area' OR [type] = 'Beach' OR [type] = 'District' OR [type] = 'Attraction' then 1when [type] = 'Business Area' OR [type] = 'Convention Centre' then 2 else 3 end, url from CityLocations where CityID = 1037 and Latitude < 9.967687 and Latitude > 9.807687 and Longitude < 76.396958 and Longitude > 76.236958 order by tipo