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
 General SQL Server Forums
 New to SQL Server Programming
 what functions to manipulate numbers and decimals

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-10-15 : 23:23:00
what re the sql functions to manipulate numbers, decimals, dates..
1/ like if I have 123443.78654 I want to display just 2 decimals : 123443.78 or 3 decimals ..
2/ also if I want to have bankers rounding
3/ how about dates conversion : from string to date type and vice versa and adding dates, substracting dates, getting the day, the month....
what re the SQL functions to do that pls

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-10-15 : 23:28:32
1. You can use CONVERT function to limit no. of decimals
e.g. select CONVERT(NUMERIC(10,2), 100.272478)
2. What do you mean by bankers rounding? There are rounding functionsl like ROUND(), CEILING() and FLOOR() which you can use as per your requirement.
3. Again CONVERT function will help you to convert from dates to string... Also see date functions in BOL.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-15 : 23:44:08
"2/ also if I want to have bankers rounding"
http://www.mcse.ms/archive94-2004-11-1255542.html
http://blogs.msdn.com/ericlippert/archive/2003/09/26/53107.aspx
http://support.microsoft.com/?kbid=196652



KH

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-10-15 : 23:56:22
Wow, KHTan!!

That's wonderful bunch of articles...Thanks !!!

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-16 : 00:00:50
I just google for it and . . .


KH

Go to Top of Page
   

- Advertisement -