You need to specify what type of numeric you need e.g.,
numeric(10,2) so your code should start with (say)
DECLARE @inputUnits varchar(50), @unitInCase numeric(10,2),
See https://docs.microsoft.com/en-us/sql/t-sql/data-types/decimal-and-numeric-transact-sql?view=sql-server-ver15 for info about numeric and decimal data types (which are synonymous). Broadly speaking, the first number represents the number of digits you wish to track (on both sides of the decimal point), whereas the second number is the number of digits after the decimal point.
See db<>fiddle with the code before and after.
In the example below, it shows what happens if you don’t set the scale and precision.
DECLARE @x numeric; SET @x = 1.234567890; SELECT @x; -- Result is 1
CLICK HERE to find out more related problems solutions.