Help needed for Data formatting.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mik357@hotmail.com

    Help needed for Data formatting.

    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)
  • Plamen Ratchev

    #2
    Re: Help needed for Data formatting.

    SQL Server is not the correct place to format your result set. Formatting
    belongs to the client interface.

    For the DECIMAL values you can CAST to INTEGER:

    SELECT CAST(column1 AS INT);

    HTH,

    Plamen Ratchev


    Comment

    Working...