Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SQL - How to decrease decimal places (or remove the extra zero's at the end)

Posted on 2008-10-29
1
1,084 Views
Last Modified: 2012-08-14
I have a table1 that saves the duration for a trip. table1 contains the following columns:
hourStart
hourEnd
minuteStart
minuteEnd

To calculate the duration of the trip, I am using the following query:
select ((hourEnd-hourStart) + ((cast((minuteEnd-minuteStart) as decimal))/60)) as trip  from table1

This works, except the results have too many zero's at the end:
1.500000

I want to format this as followed:
1.50

Is there a way to decrease the decimal places (or remove the extra zero's at the end)?
0
Comment
Question by:fippif
1 Comment
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22833516
select cast(value as decimal(18,2))
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
sql server query 12 26
SQL Query 2 34
What is this datetime? 1 19
xml files 7 25
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question