After testing I found that it was not the decimal place that was causing the problem, it was the precision (10)

This doesn't work: Arithmetic overflow error converting varchar to data type numeric.

DECLARE @TestConvert VARCHAR(MAX) = '123456789.12343594'

SELECT CAST(@TestConvert AS DECIMAL(10, 4))

This worked

DECLARE @TestConvert VARCHAR(MAX) = '123456789.12343594'

SELECT CAST(@TestConvert AS DECIMAL(13, 4))

Should be like 9 int + 4 floating = 13 chars

Answer from codingbiz on Stack Overflow
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ sql โ€บ t-sql โ€บ functions โ€บ cast-and-convert-transact-sql
CAST and CONVERT (Transact-SQL) - SQL Server | Microsoft Learn
Conversions to binary, char, nchar, nvarchar, varbinary, or varchar are truncated, except for the conversions shown in the following table. 1 Error returned because result length is too short to display. SQL Server guarantees that only roundtrip conversions, in other words conversions that convert a data type from its original data type and back again, yield the same values from version to version. The following example shows such a roundtrip conversion: DECLARE @myval DECIMAL(5, 2); SET @myval = 193.57; SELECT CAST(CAST(@myval AS VARBINARY(20)) AS DECIMAL(10, 5)); -- Or, using CONVERT SELECT CONVERT(DECIMAL(10, 5), CONVERT(VARBINARY(20), @myval)); GO
Discussions

sql server - Converting varchar to decimal with truncate - Database Administrators Stack Exchange
I have a column called latitude which is currently varchar(20) I want to convert it to DECIMAL(9,6) However the data stored inside the column is greater than 6 decimal points i.e. 48.12345689112345... More on dba.stackexchange.com
๐ŸŒ dba.stackexchange.com
April 12, 2023
How to convert STRING to Decimal in TSQL
I have used SELECT CAST(Answer as Decimal) and I received the following error message: "Error converting data type varchar to numeric." Thank you in advance for your help. ... A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support ... More on learn.microsoft.com
๐ŸŒ learn.microsoft.com
2
0
Change varchar data type to decimal in SQL
Hello friends, I have such a situation. I need to change varchar data type into decimal. CONVERT (VARCHAR, SUM(b.[HistoryQuantity]) / SUM(a.[TOTFCST]) * 100) + โ€˜%โ€™ AS โ€˜Biasโ€™ This is how my bias looks like right now. p.s. The only reason why i wrote Convert Varchar is because I was getting ... More on community.spiceworks.com
๐ŸŒ community.spiceworks.com
3
8
November 2, 2021
Convert Varchar round value to 2 decimals
HI I am trying to get the desired result with two decimal TEST (70.00%) but below query showing me TEST (70.000000%) 5 decimal , tried to round the values but not works Select Case when field = 'TEST' then 'TEST' + ' (' + convert(varchar, shares.[PPL Shares], 1) +'%) 'ELSE '' END from Table ... More on forums.sqlteam.com
๐ŸŒ forums.sqlteam.com
0
0
September 5, 2017
๐ŸŒ
SQLServerCentral
sqlservercentral.com โ€บ forums โ€บ topic โ€บ convert-varchar-to-numeric
Convert varchar to numeric โ€“ SQLServerCentral Forums
September 22, 2007 - No commas, no decimal points. ... QUOTE: Not all the numbers are integers UNQUOTE. I meant not all values are integer values (1,2,3 ...). There will be 1.15, 2.36 ... If 1.15 as varchar cannot be converted to 1.15 decimal how can I get 1.15 into a numeric datatype without losing precision?
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ func_sqlserver_cast.asp
SQL Server CAST() Function
SQL Examples SQL Editor SQL Quiz SQL Exercises SQL Server SQL Syllabus SQL Study Plan SQL Bootcamp SQL Certificate SQL Training ... The CAST() function converts a value (of any type) into a specified datatype.
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ answers โ€บ questions โ€บ 207420 โ€บ how-to-convert-string-to-decimal-in-tsql
How to convert STRING to Decimal in TSQL - Microsoft Q&A
I have used SELECT CAST(Answer as Decimal) and I received the following error message: "Error converting data type varchar to numeric." Thank you in advance for your help. ... A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
Find elsewhere
๐ŸŒ
SQLTeam
forums.sqlteam.com โ€บ transact-sql
Convert Varchar round value to 2 decimals - Transact-SQL - SQLTeam.com Forums
September 5, 2017 - HI I am trying to get the desired result with two decimal TEST (70.00%) but below query showing me TEST (70.000000%) 5 decimal , tried to round the values but not works Select Case when field = 'TEST' then 'TEST' + ' (' + convert(varchar, shares.[PPL Shares], 1) +'%) 'ELSE '' END from Table Result = TEST (70.000000%) Select Case when field = 'TEST' then 'TEST' + ' (' + convert(varchar, round(shares.[PPL Shares], 1),2) +'%)' ELSE '' END from Table Result = T...
๐ŸŒ
W3Docs
w3docs.com โ€บ php
Converting Varchar Value to Integer/Decimal Value in SQL Server
In SQL Server, you can convert a varchar value to an integer or decimal value using the CAST or CONVERT function.
๐ŸŒ
SQLServerCentral
sqlservercentral.com โ€บ forums โ€บ topic โ€บ convert-varchar-to-decimal-2
Convert Varchar to Decimal โ€“ SQLServerCentral Forums
February 13, 2013 - ... You are replacing the comma with an empty string, that will result in incorrect results even without running into the overflow. have a look at the 2 examples below, that should illustrate where your problem lies ยท SELECT CONVERT(DECIMAL(15,1), REPLACE('1,0000000000000001', ',',''))
๐ŸŒ
Narkive
microsoft.public.sqlserver.programming.narkive.com โ€บ ZvZlvyxv โ€บ how-do-you-convert-varchar-to-decimal
How do you Convert Varchar to Decimal
Run SELECT * FROM AmountsTbl WHERE ISNUMERIC(Amount) = 0 This will give you the rows where the data can not be converted. Regards Mike ยท Post by Mark ID (autonumber) Amount (varchar(50)) Amount_dec (decimal(18,2)) All I want to do is update Amount_dec to the decimal value of Amount.
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ func_sqlserver_convert.asp
SQL Server CONVERT() Function
The CONVERT() function converts a value (of any type) into a specified datatype. Tip: Also look at the CAST() function. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ sql โ€บ sql-query-to-convert-varchar-to-int
SQL Query to Convert VARCHAR to INT - GeeksforGeeks
CAST() is ideal when we are sure that the VARCHAR value contains only numeric characters and that the conversion will succeed. ... target_type โ€“ Target data type to which the value will be converted. e.g. INT, BIT, SQL_VARIANT, etc.
Published ย  July 23, 2025
๐ŸŒ
Snowflake Documentation
docs.snowflake.com โ€บ en โ€บ sql-reference โ€บ functions โ€บ to_decimal
TO_DECIMAL , TO_NUMBER , TO_NUMERIC | Snowflake Documentation
Converts an input expression to a fixed-point number. These functions are synonymous. ... TO_DECIMAL( <expr> [, '<format>' ] [, <precision> [, <scale> ] ] ) TO_NUMBER( <expr> [, '<format>' ] [, <precision> [, <scale> ] ] ) TO_NUMERIC( <expr> [, '<format>' ] [, <precision> [, <scale> ] ] ) ... An expression of a numeric, character, or variant type. ... The SQL format model used to parse the input expr and return.
๐ŸŒ
SQL Shack
sqlshack.com โ€บ sql-convert-function
SQL Convert Function
June 25, 2019 - At first, we will interpret the syntax of the SQL CONVERT function. data_type: This parameter defines the target data type which is to be converted. data_type parameter can take these data types as an input which are shown in the below array list.
๐ŸŒ
SQLServerCentral
sqlservercentral.com โ€บ forums โ€บ topic โ€บ conversion-of-currency-stored-as-varchar-to-decimal
Conversion of currency stored as varchar to decimal โ€“ SQLServerCentral Forums
September 20, 2022 - select TRY_CONVERT(decimal (10,2),REPLACE(REPLACE('$16,500.50','$',''),',','') ) ... This reply was modified 3 years, 5 months ago by masterelaichi. ... Mr or Mrs. 500 ... SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers".
๐ŸŒ
LearnSQL.com
learnsql.com โ€บ cookbook โ€บ how-to-convert-an-integer-to-a-decimal-in-sql-server
How to Convert an Integer to a Decimal in SQL Server | LearnSQL.com
SELECT CONVERT(DECIMAL(7,2), 12) AS decimal_value; This query produces the same result as CAST(), but takes two mandatory arguments: the data type and an expression, value, or column name to convert.
๐ŸŒ
Reddit
reddit.com โ€บ r/sql โ€บ ms sql: error when converting varchar to numeric.
r/SQL on Reddit: MS SQL: error when converting varchar to numeric.
November 30, 2020 -

I have a view consisting of some 90 underlying tables. When working with that view, I get the message 'error when converting datatype to numeric'. After some detective work I found the column resposible for this error. Among the underlying tables, this column is a mixture of decimal(10,2) and numeric(18,2). Both datatypes are functionally equivalent it appears, so I see no problem there. Or am I wrong in this? My primary concern is the mention of 'varchar' in the error message. How is that even possible, as no varchar is involved?

Working on SQL Server 13.0.

๐ŸŒ
Appeon Community
community.appeon.com โ€บ index.php โ€บ qna โ€บ q-a โ€บ decimal-values-incorrectly-passed-to-sql-server-as-varchar
Decimal values incorrectly passed to SQL Server as varchar - Appeon Community
..... You will get a SQL Server error: Conversion failed when converting the varchar value '7.990 ' to data type int. ... UPDATE my_table SET my_old_price = CONVERT(numeric, (CASE WHEN CONVERT(numeric :ldec_value) <> my_old_price then CONVERT(numeric, :ldec_value) else my_old_price END)) WHERE my_id = :ll_id; ... I shouldn't have to encapsulate the datatypes. Powerbuilder should know that a decimal ...