New answers tagged


Run the query in SSMS and look at the actual execution plan. Highlight the Compute Scalar and look at its properties (F4). Look at the Defined Values property. On my system I got this: [Expr1008] = Scalar Operator(db_name()), [Expr1009] = Scalar Operator(CONVERT(int,[Expr1013]/(128.0)CONVERT_IMPLICIT(numeric(10,0), fileproperty([ReadReceipt].[sys].[...


I am struggling to find the reason of the arithmetic overflow. why is it happening? Most likely the metadata is returning some unexpected values that your code cannot handle. For example: -- Example values returned from sysfiles and FILEPROPERTY DECLARE @size integer = 1, @spaceused integer = 10000; -- The essence of the code in the question ...


Maybe you have forgotten that a file can have 100% free space? In that case you need DECIMAL(5,2), not DECIMAL(4,2).

Top 50 recent answers are included