Formatted output to a file

  • Dear all,

    I am attempting to produce an output to a file. This file must be formatted with new lines and spaces and page breaks. The sql to run this is a stored procedure.

    Store procedure example is as follows, please note is is a load of rubbish and not the one I use but it gets the example across.

    Select Forename + char(10) + Surname + char(10) + Title + char(12) +char(10) + char(10) from person.

    This should produce a text file with the following format:-

    Julie

    Wilson

    Miss

    -------------Page Break---------------

    In the report.

    It does not. Insead it produces

    Julie

    Wilson

    Miss

    Without the extra new lines at the bottom and without the page break.

    Please note I use DTS as the medium to produce the file.

    Can anyone help me ?

    Thanks

    J

    Edited by - JulieW on 11/27/2003 02:32:32 AM

  • Firstly, what are you using to view the text file output? To see the results correctly you'll need to use something that understands the control codes like MS Word.

    Also, try using char(13) and char(10) as your line break.

    eg:

    
    
    Select
    au_fname + char(13) + char(10)
    + au_lname + char(13) + char(10)
    + au_id + char(13) + char(10)
    + char(13) + char(10)
    + char(13) + char(10) + char(12)
    from pubs.dbo.authors

    Hope this helps

    Phill Carter

    --------------------

    Colt 45 - the original point and click interface

    --------------------
    Colt 45 - the original point and click interface

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

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