Sql – Conversion failed when converting the nvarchar value ‘S’ to data type int

sqlsql server

I was playing with SQL. AdventureWorks2012 database, table: Production.Products.

I was trying to get products which have color black and: either have weight NULL or their size and listPrice is above some value.

Here is query

SELECT * 
FROM AdventureWorks2012.Production.Product 
WHERE (Color = 'Black') 
  AND ((ListPrice > 300 AND Size > 60) OR Weight IS NULL)

But this is the error I get

Conversion failed when converting the nvarchar value 'S' to data type int.

Can anyone clarify what I did wrong?

Best Answer

Size is nvarchar(5), so that's where your S is coming from.

Check out the schema for Adventureworks

Related Topic