Carriage Return CSV (Unix format)

  • Hello

    Does anyone know how i can export data from sql server 2005 and create a carriage return (unix format) csv file, which is generated from a query.

    While this is done it is to be sheduled using a job, and an incremental file name will be created any time a job is excuted.

    filenames will be xxx0001 (if executed today), xxx0002(if executed tomorrow), xxx0003 (if executed the day after)

    Also the files will be dumped at a shared gateway server

  • b-boy, if your data source for the CSV file is a query you can try this...

    Select + char(13) + char(10). This will append CR/LF characters to the last column.

    DAB

  • Hiya

    Will this be at the end of my query, begining or within?

    eg:

    select * from table where + char(13) + char(10).

  • No, it is part of the SELECT clause...

    select servername, driveLetter + char(10) + char(13)

    from freedrivespace

    If the last column is numeric or date, you will need to wrap a CONVERT statement like

    [Code]select servername, convert(varchar,freespaceMb )+ char(10) + char(13)

    from freedrivespace[/code]

Viewing 4 posts - 1 through 3 (of 3 total)

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