Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / June 2008

Tip: Looking for answers? Try searching our database.

Help needed - Data Formatting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mik357@hotmail.com - 30 Jun 2008 18:59 GMT
Hello all,

I just started using SQL to create a report. I got the syntax working
but I have absolutely no idea of how to format data. Can anyone kindly
look at my code and help me? I thank you in advance.

Details:-

The code:

SELECT Column1, Column2, Column3
   FROM WORKSHEET

Output:
Column 1      Column2             Column3
     23.00  a      23a
     23.00  b       age2

The output I want:
aCol1           aCol2               aCol3
23                  a                     23a
23                  b                     age2

NOTE: the column headings have to be bolded.

In conclusion, the following is what I want:
. the column data should be centered
. how to change column headings and make them bold
. the numeric value should be set as integer value (i.e. 12) instead
of default double value (i.e. 12.00)
Author - 30 Jun 2008 19:09 GMT
On Jun 30, 1:59 pm, mik...@hotmail.com wrote:
> Hello all,
>
[quoted text clipped - 26 lines]
> . the numeric value should be set as integer value (i.e. 12) instead
> of default double value (i.e. 12.00)

SELECT CAST(Column1 as decimal(8, 0)) as aCol1, Column2 as aCol2,
Column3 as aCol3
FROM WORKSHEET

As for bolding and centering, they are not part of SQL, you have to do
it in your client application.

HTH.
Aaron Bertrand [SQL Server MVP] - 30 Jun 2008 19:36 GMT
I answered this in another group.  Please don't multi-post.

On 6/30/08 1:59 PM, in article
a846eded-4713-4512-93a3-f5187eed3f3b@l64g2000hse.googlegroups.com,

> Hello all,
>
[quoted text clipped - 29 lines]
>
> of default double value (i.e. 12.00)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.