Solved

Transact SQL statement to display a decimal value to 1 decimal place

Posted on 2012-03-13
2
428 Views
Last Modified: 2012-03-13
I have a column named WinPct defined as decimal(8.0)

The following statement returns WinPct as a hole number:

SELECT WinPct FROM HMHoleRankings  ...

17
16
16
16
15
15

Stored values are 17.2, 16.5, 16.3, 16.0 etc.

What is the syntax or displaying the stored values?

Thanks,
0
Comment
Question by:Dovberman
[X]
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
2 Comments
 
LVL 37

Accepted Solution

by:
ValentinoV earned 500 total points
ID: 37714795
Try CONVERT(decimal(8,1), WinPCT)

But in your case I think you'll always get ".0" because the zero in your data type definition indicates that there are no digits to the right of the decimal separator.

If your column is supposed to store numbers with up to one digit after the decimal separator, then the definition should become decimal(8,1).

See also: http://msdn.microsoft.com/en-us/library/ms187746.aspx
0
 

Author Closing Comment

by:Dovberman
ID: 37714909
Perfect. Thank you.
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

752 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