If you’re running SQL Server and trying to convert a column of data from nvarchar to bigint, you may receive the error converting data type nvarchar: “The value is invalid.” There are several reasons for this error, including the fact that the SQL Server functions don’t allow you to use invalid values.
The converting process itself causes an Arithmetic overflow error. This happens because SQL Server can only store the number 999 before the decimal point. To fix this issue, you must make the variable larger. For instance, you should change the @sample variable to NUMERIC (6,2) instead of nvarchar.
Another reason you may encounter this error is that you are inserting a value that is out of range. This occurs if you insert a large number or text value in an integer field. You may also encounter this error if you’re using a function such as SUM() that returns values outside the range of the column type. Fortunately, SQL Server has a solution for this issue.
The error message will also tell you the SQL line where the data insertion failed. This information is not always accurate, but it’s a good way to find out which column is causing the problem. In some cases, the SQL error message will even tell you the data type.