Solved

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

Posted on 2012-03-13
2
426 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
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

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.
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

770 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