## 3 replies

Last post Mar 30, 2015 02:22 AM by Edwin Guru Singh

• sushsudh

Member

27 Points

181 Posts

### float rate percentage

select Rate from sales where Id=1

O/p:

Rate

0.0925

How to get that into percentage like 1%,2%

rate is float in  the table

rate float percentage

• oned_gk

All-Star

51471 Points

15199 Posts

### Re: float rate percentage

Try set boundfiled dataformat string

`DataFormatString = "{0:P}"`

rate float percentage

Programming to simplify, don't look for difficult way
• wmec

Contributor

6354 Points

5583 Posts

### Re: float rate percentage

Try

```select cast(cast(round(0.0925*100,0) as int) as varchar)+'%'
go```

rate float percentage

Many Thanks & Best Regards,
HuaMin Chen
• Edwin Guru S...

Star

8536 Points

1376 Posts

### Re: float rate percentage

Mar 30, 2015 02:22 AM|Edwin Guru Singh|LINK

#### sushsudh

O/p:
Rate
0.0925

How to get that into percentage like 1%,2%

As per your case, you can try like following query :

```create table sales (
id int,
rates float)
----------------------------
insert into sales values (1,0.0925),(2,0.0825),(3,0.9925),(4,0.8932),(5,0.1025);
----------------------------
select id,rates from sales
----------------------------
select id,rates,CAST((rates*0.01) as varchar)+' %'[1%],CAST((rates*0.02) as varchar)+' %'[[2%] from sales```

--
with regards,
Edwin

rate float percentage

with regards,
Edwin