How convert oracle select function to sql server

What is the data type of the weight column? The fact that you have values with different precision tells me that it is a string (varchar).

But further to that - the value .67 converted to an integer as 67 and the value .567 converted to the integer 567 will be viewed incorrectly - because .67 is actually greater than .567 but will be viewed as less than which is not correct.

To be correct - you need to parse out the decimal to the same precision for all values. That can be done easily enough by multiplying the result by 1000 (3 decimal places = 670) or 10000 (4 decimal places = 6700).

I would recommend leaving the decimal place for gms - it is more accurate than trying to convert the value to an integer.

1 Like