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.
| Author |
Topic |
|
chippyles
Yak Posting Veteran
68 Posts |
Posted - 2006-07-10 : 10:52:58
|
| I need change the format of an object float(8) named C2In MsAccess I can simply do this...Format([C2],"#.##")Original NumberC2 = 0.154Expected ResultsC2 = 0.15I am unsure how to do this in SQL |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-07-10 : 11:25:17
|
| Don't format your data with T-SQL. It is not designed to do that. Just return the data back. Let your client format it. - Jeff |
 |
|
|
chippyles
Yak Posting Veteran
68 Posts |
Posted - 2006-07-10 : 11:26:44
|
| I need to do this before the client gets a hold of the data |
 |
|
|
nathans
Aged Yak Warrior
938 Posts |
Posted - 2006-07-10 : 11:27:56
|
Are you looking to round the output?declare @C2 float(8)set @C2 = '0.154'select @C2, round(@C2, 2) Nathan Skerl |
 |
|
|
chippyles
Yak Posting Veteran
68 Posts |
Posted - 2006-07-10 : 11:34:52
|
| I tried that. OriginalC2 = 0.154Round resultsC2 = 0.150I need the "0" to dissappear. |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-07-10 : 12:41:50
|
?declare @C2 float(8)set @C2 = '0.154'select @C2, cast(cast(@C2 as decimal(8, 2)) as varchar(10))/*results------------------------ ---------- 0.154 0.15*/ Ryan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-07-11 : 02:10:35
|
quote: Originally posted by chippyles I need to do this before the client gets a hold of the data
Do you use front end application? If so, use format function there. You can use Ryan's method but actually it is varchar and not Numeric so that you cant use it for calculations until you convert it back to numericMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|