Hi.
I have 2 SQL queries which are running fine in few databases but in some I am getting the error as : Arithmetic overflow error converting float to data type numeric
Below are the queries used:
SELECT
Format(CAST(COLUMNAME1 AS DECIMAL(30,4)),'+00000000000000000000000000.0000;-00000000000000000000000000.0000'),
Format(CAST(COLUMNNAME2 AS DECIMAL(30,4)),'+00000000000000000000000000.0000;-00000000000000000000000000.0000')
FROM TableName
SELECT 9, COUNT(*)+2 ,
Format(SUM(CAST(ISNULL(NULLIF(COLUMNNAME1, ''),0) AS DECIMAL(30,4))) ,'+000000000000000000000000000.0000;-000000000000000000000000000.0000') AS CHEC0,
Format(SUM(CAST(ISNULL(NULLIF(COLUMNNAME2, ''),0) AS DECIMAL(30,4))),'+000000000000000000000000000.0000;-000000000000000000000000000.0000') AS CHEC1
FROM TableName
what should be edited in the above 2 queries to avoid this error ? I believe this is a Data issue, but is there any code fix which can be set ?