Skip to content
Advertisement

Error :: “Conversion failed when converting the nvarchar value ‘cereals’ to data type int” in Dynamic SQL

I am trying to “Order by” my table by Id in Dynamic SQL, though it works with Name and Description (Both Type Nvarchar) as shown but not Working with Id (type INT), Here is my Dynamic SQL Query

The Line Gives Following Error

Conversion failed when converting the nvarchar value ‘cereals’ to data type int.

I print SQL It shows …

Please Help me with this, I am new to sql.

Advertisement

Answer

You could replace the entire CASE expression with …

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement