How to output query results as fixed length fields

  • I have a query that needs to output fixed length fields.

    Query has:

    convert(char(20), field name) as field heading but output is not 20 character field.

    Any ideas?

  • Do you have ANSI padding on ?

    http://msdn.microsoft.com/en-us/library/ms187403.aspx

    Jayanth Kurup[/url]

  • That worked - 2 more questions

    How can I change NULL results to be blank instead of NULL?

    How can I save the results without , between fields?

    Thanks,

  • Oops wrong forum ]

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Jim Woods (6/26/2011)


    How can I change NULL results to be blank instead of NULL?

    ISNULL(somecolumn,'')

    How can I save the results without , between fields?

    Concatenate the columns into one big column.

    ColumnA+ColumnB+ColumnC+....

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply