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)
 How to add the value(0.value)

Author  Topic 

shah
Starting Member

5 Posts

Posted - 2007-06-28 : 08:21:34
Dear Experties,

i have a doubt...

In credit amount field
i need to add "0.Value" if its start with '.00'
or ".345" then "0.345"

Ex:
create table xxx(name varchar(20),salary decimal(34,4))
insert into xxx values('dee',0)

then the output vl b
name salary
dee .0000

but i want it to b "0.0000"

how can i do this

Thanks in advance


shah

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-28 : 09:01:50
What is the datatype of that column?

Madhivanan

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

shah
Starting Member

5 Posts

Posted - 2007-06-28 : 09:06:09
decimal

shah
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2007-06-28 : 21:47:49
It's a presentation issue - the value is correct so you should do it in the front end unless you want to convert it to a string (which would be totally the wrong thing to do).
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-29 : 00:05:12
Yes. If you want to show them in front end, do formation there. Or you can cast it to FLOAT datatype

Madhivanan

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

- Advertisement -