24.5.10

Convert decimal values in SQL Server

Convert a integer value with multiple decimals to fixed number of decimals(2 decimals):

Consider a scenario, am having a decimal data and I need to restrict the decimal values. In this case, we need to use convert operator.


create table aa(id decimal(10,5))

insert into aa values(1.90955)

select convert(decimal(10,2),id) from aa

Cheers,

Venkatesan Prabu .J

No comments:

Post a Comment