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 |
usafelix
Posting Yak Master
165 Posts |
Posted - 2015-01-30 : 04:23:15
|
I have some data like this , how to write query change to desire output like this. percentage 1.100000000000001.23000000000003.0000000000output percentage1.11.233.0 |
|
jleitao
Posting Yak Master
100 Posts |
Posted - 2015-01-30 : 06:30:56
|
probably your percentage column is numeric, if you convert it to float the zeros will desapearCONVERT(float, PERCENTAGE)------------------------PS - Sorry my bad english |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2015-01-31 : 04:37:58
|
My question is "Why?". Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
jleitao
Posting Yak Master
100 Posts |
Posted - 2015-02-02 : 08:12:42
|
Why use a convert and not use a replace?!?If you have, for example, a value like 10.320000000 and if you use a replace like REPLACE(percentage, '0','') your output will be 1.32 and not 10.32Why i use a Conver and not a Cast? Because, i think it's more "user friendly" for begin users.CONVERT(float, PERCENTAGE)orCAST(PERCENTAGE as float)if your "why" it's about another thing, can you be more explicit?------------------------PS - Sorry my bad english |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2015-02-03 : 05:15:20
|
I was asking the original poster.Why then need for removing trailing zeroes. Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA |
|
|
|
|
|
|
|