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 |
doran_doran
Posting Yak Master
179 Posts |
Posted - 2008-06-04 : 17:55:52
|
I have a column rate and there are so many numbers after the digit. I just want 2 numbers after the digit.45.43454 should be 45.4332.6673 should be 32.67Thanks |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-06-04 : 17:57:42
|
Check out the ROUND function.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
doran_doran
Posting Yak Master
179 Posts |
Posted - 2008-06-04 : 18:00:40
|
there isn's one line command for this. I need to use this for a stored procedure and view. |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-06-04 : 18:01:35
|
Did you check out the ROUND function?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-06-04 : 18:04:00
|
I guess this is the one:select left(round(32.6673 ,2),5) |
 |
|
soorajtnpki
Posting Yak Master
231 Posts |
Posted - 2008-06-05 : 00:21:21
|
hiu can this too.. i made a small change the above by sodeep.. the following is a general solution provided your column is decimal. select left(round(ur_number,2),charindex('.',ur_number,1)+2) ie select left(round(32.6673,2),charindex('.',32.6673,1)+2)ok tanx |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-06-05 : 09:32:21
|
Instead of using left function, useselect cast(32.6672 as decimal(12,2))MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|