Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 6th, 2004, 09:57 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default truncating to 2 decimals

Hi
I am querying data from sqlserver there i want to display output with 2 decimal points .Doing like this
ex: select round(sales,2) from x

sales="12345.67789"

here i am getting 123456.68000 but i need to dispaly 123456.68 only.Sales data is not fixed length so i cant use left or right function.How to get with 2 decimal points?


 
Old July 7th, 2004, 12:03 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please check the following articles:

http://www.databasejournal.com/featu...0894_2222111_3
http://www.sqljunkies.com/Forums/Sho...px?PostID=1028

Om Prakash
 
Old July 7th, 2004, 12:24 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Dear om_prakash
 these article simply round the floating number into nearest decimal number and the question of msrnivas is truncate the number into two decimal places







Cheers






Love 4 all
 
Old July 7th, 2004, 02:14 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Thanks 2 all got the result

select cast(round(567.677,2,0) as decimal(20,2))



 
Old July 7th, 2004, 02:29 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

Cross post

http://p2p.wrox.com/topic.asp?TOPIC_ID=15734

Love 4 all





Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid truncating field values with apostrophes jrobbins ASP.NET 1.0 and 1.1 Professional 3 December 4th, 2007 08:24 PM
Truncating Transaction Log ninel SQL Server 2000 1 November 18th, 2006 01:26 PM
Truncating Transaction Log sgsandeep SQL Server 2000 2 July 11th, 2006 08:51 AM
truncating msrnivas .NET Web Services 2 July 7th, 2004 02:10 AM
truncating database data Adam H-W Classic ASP Databases 4 June 20th, 2004 01:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.