Apr 5, 2004 #1 rpal Programmer Joined Jun 16, 2003 Messages 37 Location US Hello, I have amount column with two 4 decimal places. EX: 2275.4559 , I want get out put only 2275.46, how to do in SQL server, I am using Sql 2000. Thanks.
Hello, I have amount column with two 4 decimal places. EX: 2275.4559 , I want get out put only 2275.46, how to do in SQL server, I am using Sql 2000. Thanks.
Apr 5, 2004 #2 TheDrider Programmer Joined Jun 27, 2001 Messages 110 Location US You can use the ROUND function to round to any place, before of after the decimal point. ROUND(2275.4559, 2) This should give you what you need. Upvote 0 Downvote
You can use the ROUND function to round to any place, before of after the decimal point. ROUND(2275.4559, 2) This should give you what you need.
Apr 6, 2004 Thread starter #3 rpal Programmer Joined Jun 16, 2003 Messages 37 Location US But It displaying results 2275.4600 I want to take out 00 and want to display only 2 decimal places. Upvote 0 Downvote
Apr 6, 2004 #4 checkai Programmer Joined Jan 17, 2003 Messages 1,629 Location US Code: CONVERT(VARCHAR,CAST(ROUND(2275.4559, 2) AS MONEY),1) Upvote 0 Downvote
Apr 6, 2004 #5 TheDrider Programmer Joined Jun 27, 2001 Messages 110 Location US Sorry, I thought you were only trying to round. If you want to truncate you can use CAST as numeric. select cast(round(1234.5678, 2) as numeric(15,2)) CAST() alone will sometimes also round, but I prefer to make sure it does what I expect. Upvote 0 Downvote
Sorry, I thought you were only trying to round. If you want to truncate you can use CAST as numeric. select cast(round(1234.5678, 2) as numeric(15,2)) CAST() alone will sometimes also round, but I prefer to make sure it does what I expect.