Wrox Programmer Forums
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services 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:58 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default truncating

Hi
I am querying data from sql 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 6th, 2004, 10:59 PM
Authorized User
 
Join Date: Jul 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jhawar
Default

try

select cast(round(sales,2,0) as decimal(Max,2)) from x
where max could be any number

hope this helps!!

Amit Jhawar
Developer
 
Old July 7th, 2004, 02:10 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

works good thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
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 to 2 decimals msrnivas Classic ASP Components 4 July 7th, 2004 02:29 AM
truncating database data Adam H-W Classic ASP Databases 4 June 20th, 2004 01:28 PM
Date Format - Truncating - Plz Help - THNX ! ank2go VB.NET 2002/2003 Basics 2 March 30th, 2004 11:26 PM





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