Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2012-03-13
2
Medium Priority
?
431 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

722 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