Output to grid file

  • Hi,

    I created a shell script (Windows XP) that runs a stored procedure (SQL-2005) using OSQL ... and directs output to a file. The problem is that the file is text format and all fields are jammed into one line. Is there a way to output the data into a readable format, like excel?

    Thanks

  • Did You try SSIS?

  • alark (11/4/2009)


    Hi,

    I created a shell script (Windows XP) that runs a stored procedure (SQL-2005) using OSQL ... and directs output to a file. The problem is that the file is text format and all fields are jammed into one line. Is there a way to output the data into a readable format, like excel?

    Thanks

    Tell OSQL to use a TAB as a delimiter and Excel will have no problem opening the file.

    --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)

  • Thank you Jeff, this is exactly what I needed. It worked just fine. Unfortunately I can not use SSIS because the scripts should reside off the SQL server.

  • Glad I could help. As a side bar, I pretty much refuse to use SSIS for any form of ETL...

    --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)

  • Since this is SQL Server 2005, you should be using SQLCMD vs. OSQL. OSQL is obsolete


    [font="Arial Narrow"](PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.[/font]

  • Thank you. I've changed it to SQLCMD and even found a new option -W to make the output to look better

Viewing 7 posts - 1 through 6 (of 6 total)

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