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 |
|
dineshkunder
Starting Member
9 Posts |
Posted - 2005-08-03 : 12:09:17
|
| Thanks in advance! I get the result 2.33333333333.. from the foll. query. But how do I get 2.333, basically how do I format a computed columns in sequel similar to FormatNumber function in VBScript?? Also I do not want to cast result as a string and return only left 5 characters, as I need to also order by computations..select cast(7 as float)/3 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-08-03 : 16:14:33
|
The stock answer for this type of question is that you should use the Application [layer] to do the formatting, rather than the Database. However, there is a ROUND() function in SQL which may do the job.Alternative you could use a DECIMAL datatype for the column, which allows a specific number of decimal places (rather than, say, the FLOAT datatype which is at the mercy of binary artihmetic)Kristen |
 |
|
|
kapilarya
Yak Posting Veteran
86 Posts |
Posted - 2005-08-04 : 07:17:08
|
| check this.. SELECT ROUND(150.76853544545, 2, 1)Kapil Arya |
 |
|
|
|
|
|