Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Formating of decimal number in SQL Query

Author  Topic 

guptaalok12
Starting Member

5 Posts

Posted - 2009-09-03 : 05:32:06
i have decimal field in table.Whenever i select rocords from table.it gives in decimal.But i want when data is(12.00) it should give
(12) not (12.00).How i will get it.
T1
==
X 12.50
y 54.00
Z 78.80
Q 23.00
Select * from T1
Oouput shold be
==
X 12.50
y 54
Z 78.80
Q 23




alokgupta

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-09-03 : 05:36:06
It would be better to do this in your front end app.
But else I would try
replace(convert(varchar(10),dec_col),'.00','')


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-03 : 06:06:42
quote:
Originally posted by guptaalok12

i have decimal field in table.Whenever i select rocords from table.it gives in decimal.But i want when data is(12.00) it should give
(12) not (12.00).How i will get it.
T1
==
X 12.50
y 54.00
Z 78.80
Q 23.00
Select * from T1
Oouput shold be
==
X 12.50
y 54
Z 78.80
Q 23




alokgupta


Where do you want to show data?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -