Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7918587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:33:34+00:00 2026-06-03T15:33:34+00:00

Using SQL Server 2000 I want to reduce the decimal length Query Select 23/12

  • 0

Using SQL Server 2000

I want to reduce the decimal length

Query

Select 23/12 as total

Output is showing as 1.99999999999

I don’t want to round the value, I want to diplay like this 1.99

Tried Query

Select LEFT(23/12, LEN(23/12) - 3) as total

The above query is working only if there is decimal value like 12.444444, but if the total is single digit means like 12 or 4 or 11…., i am getting error at run time.

How to do this.

Need Query Help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:33:37+00:00Added an answer on June 3, 2026 at 3:33 pm

    There is a very simple solution. You can find it in BOL. Round takes an optional 3rd argument, which is round type. The values are round or truncate.

    ROUND numeric_expression , length [ ,function ] )

    …

    function Is the type of operation to perform. function must be
    tinyint, smallint, or int. When function is omitted or has a value of
    0 (default), numeric_expression is rounded. When a value other than 0
    is specified, numeric_expression is truncated.

    So just do

    Select ROUND(cast(23 as float)/12, 2, 1) as total
    

    That gives 1.91. Note, if you were really seeing 1.999 – something is really wrong with your computer. 23/12 = 1.916666666(ad infinitum). You need to cast one of the numbers as float since sql is assuming they’re integers and doing integer division otherwise. You can of course cast them both as float, but as long as one is float the other will be converted too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using SQL Server 2000 My Query. SELECT (Format(IIf(CLng(OutTime) > 180000, CDate('18:00:00'), CDate(Format(OutTime, '00:00:00'))) -
I am using SQL Server 2000 and want to write a simple query to
Using SQL Server 2000 I want to select the id according to the department
Using SQL Server 2000 I want to get the max(date) of total for each
work on SQL Server 2000. want to Automated Email Notifications using SQL Server Job
We're using SQL Server 2000 Query Analyser, and one issue we have is that
i am using sql server 2000 i want to create a table having id
Using SQL Server 2000 I am trying to use this command in Query Analyzer
I'm using pyodbc with SQL Server 2000. I want to be able to insert
Using SQL Server 2000 dtptime - datetimepicker (Format: Custom Format(HH:mm) Query insert into table1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.