Error when running a query


I am getting an issue when I run this query. It is tell me that Arithmetic overflow error converting nvarchar to data type numeric.

Here is a subset of the query I am running as it is long.

CREATE TABLE NeighbourhoodAverages (ID INT IDENTITY (1,1), Village varchar(50), Neighbourhood varchar(50),  Domain nvarchar(max), Question nvarchar(max), Average nvarchar(50), Year nvarchar (50))

INTO NeighbourhoodAverages
	, Neighbourhood
	, Question
	, Average
	, Year)
SELECT CONCAT(Village, Setting) AS Village
	, Neighbourhood
	, 'IcanbealonewhenIwish' as QUestion
	, 100.0 *
		Count(Case when CanbealonewhenIwish IN (3.00,4.00)
			THEN 1
		COUNT(*)          AS Average
	, Year
FROM Resident_Survey
Group By Village, Setting, Neighbourhood, Year

I am not running create table everytime I just included that so you could see what the table looks like.


what is the datatype of CanbealonewhenIwish?

nvarchar (max). In the table it is being populated as question.

well, in that case you might try

CASE WHEN CanbealonewhenIwish IN ('3.00','4.00')

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.