[SQL] Can’t convert nvarchar to decimal and arithmetic overflow

Sometimes when importing datasets, or using already imported datasets in sql, the values of amounts are in nvarchar. If a cell contains a NULL value then you will not be able to sum that column. You might get the following error: “Can’t convert nvarchar to decimal and arithmetic overflow”. In this case you can create a case statement and check if the column datatype is numeric or not. If it is numeric then you can cast it as money. Else you can set the value to 0. You might want to check if there are letters in the specific column that need to be parsed out.

Leave a Reply

Your email address will not be published. Required fields are marked *