Left side of floating point number in Sql Server

I have a query that returns a column of floating point numbers, but I'm only interested in the number to the decimal point. I don't want to round a number, so I'm looking for something like:

1.95 = 1
1.45678 = 1
12.00 = 12
12.9999 = 12

Is there an easy way to achieve this in SqlServer besides executing a substring?

+3
source share
3 answers

You can use the function.

+3
source

You can do it -

SELECT CAST(1.230 AS INT)

Output: 1

+5
source

ROUND(expression, 0, 1) T-SQL. . MSDN .

+1

Source: https://habr.com/ru/post/1706375/


All Articles