Let's see an interesting article on data type conversion,
select 8.5
-- The output is 8.5
Using convert operator to convert a float value into an integer:
select convert(int,8.9)
Floor and ceiling functions in SQL Server:
Floor function is used to get the lowest possible integer value from the given float value
select floor(8.9)
-- The output will be 8
Ceiling function is used to fetch the possible maximum value(next possible integer value) from the given float value.
select ceiling (8.9)
-- The output will be 9
select ceiling (8.4)
-- The output will be 9
Using Cast operator in the conversion process:
select cast (8.9 as int)
The above statement will try to cast the value into a possible integer. An equivalent to floor function.
Thanks and Regards,
Venkatesan Prabu .J
1 comment:
PL/SQL means Procedure Language/SQL not Programming Logic/SQL
Post a Comment