So I have a table with numbers in decimals, say
id value 2323 2.43 4954 63.98
And I would like to get
id value 2323 2 4954 63
Is there a simple function in T-SQL to do that?
The TRUNC Function[1] is an Excel Math and Trigonometry function. It removes the fractional part of a number and, thus, truncates a number to an integer. It was introduced in MS Excel 2007. In financial analysis, the function can be used to truncate a number to a given precision.
SELECT FLOOR(value)
http://msdn.microsoft.com/en-us/library/ms178531.aspx
FLOOR returns the largest integer less than or equal to the specified numeric expression.
Assuming you are OK with truncation of the decimal part you can do: SELECT Id, CAST(value AS INT) INTO IntegerTable FROM NumericTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With