You don't have a number in the database, you have a string.
Some people long ago thought that it was a great idea for computers to not care about the variable type - just store the data and let the computer figure it out at runtime.
Then they tried that for a while and discovered that it was a bad idea. They invented strong typing so that the programmer would have to make sure everything was right at design time rather than let it fail at run time.
New people came along and thought that was a lot of work and slowed down the developers. So they invented automatic type conversion.
Many of them figured out pretty quickly that was a bad idea and started calling it Evil Type Coercion. Sometimes there were compiler options to turn off the evil type coercion and force strict typing.
New people came along and thought that was a lot of extra work and slowed down the developers. Contracts can't change as quickly as the whims of the dreamers. They invented weakly typed variables and called it Duck Typing.
Some people realized that was a bad idea and invented a new language that tries to enforce strict typing over a duck typing language.
And then some people thought anonymous types would be a good idea and the pendulum keeps going back and forth.
At some point, some really smart people crashed their very expensive vehicle because some of them were using Miles and others were using Kilometers but the code didn't indicate the units. It was made obvious why numbers need units - either as a property of the object or in the variable name.
So, you have a variable that has units (a really good thing) but is no longer a number. Much of the infrastructure you are using would be happy to automatically convert a string that contains a number into a number (automatic type conversion) but you don't have a number in a string (or nvarchar). You have a combination of digits and characters.
- store the number as a number in the database. Give the column a name that is explicit about units (kg) if the units are always the same, or add another column that has the units.
- store the number as a string in the database. Give the column a name that is explicit about units (kg) if the units are always the same, or add another column that has the units.
- store the number and the units as a string in a single column in the database. This is what you have shown us.
If you do Option 1 then you can SELECT the number directly - no conversions are needed. You will not get the error.
If you do Option 2 then you can SELECT the string and it will be converted to a number for you automatically (probably by the database driver in Java, but you don't really care). You will not get the error.
If you do Option 3 then you will have to explicitly separate the number part of the column from the non-numeric part of the column (i.e., Parse). If the units are always kg then you can just throw them away in the actual SELECT statement. That is what the examples above are showing you. If you do that then the database server is doing the conversion for you.