unwanted blank row in txt file when using isql >>

  • I use a batch file that runs two ISQL commands that build a text file: (see below)

    ISQL -U sa -P Qwe123 -S Scilab2 -d Exp -Q sproc_get_AuditHeader -o \\scilab2\Fileh.dat -w 2555 -n /h-1 -s

    ISQL -U sa -P Qwe123 -S Scilab2 -d Exp -Q sproc_get_AuditDetail >> \\scilab2\Fileh.dat -w 2555 -n /h-1 -s

    My problem is that a blank row gets created in between the two ouputs to my fileh.dat file. Right in the middle of my perfectly good dat file is this unwanted blank row which happens to be where the first query finished and where the second ISQL query begins appending (>>) to the same file. I am using SQL 6.5

    Is there any way I can get rid of the blank row stuck in the middle of my dat file? The sprocs in the -Q's are simple SELECT statements.

    I've already tried writing to two separate dat files and using a DOS command to copy them into one file but it still has the blank row. I read that ISQL creates a blank row at the end. Is there any way to get around this?

  • If the queries are on the same server and return the same number of columns of the same datatype, redo your queries in a union

    Query1

    UNION ALL

    Query2

    That way they output together. Otherwise I don't believe there is a way internal to isql.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Thanks for trying, but the data is from two totally different tables. One table shows header data and the other is the detail data for each header.

    I found an article about a COM object that I'm going to try Monday. I'll let you know if it worked.

    Thanks...

  • You can format the rows yourself and insert them into a global temporary table and then do the output from that.

    You can then use bcp or isql for the output.


    Cursors never.
    DTS - only when needed and never to control.

  • Could also do a clean up operation using the FileSystemObject and a little VB Script. Another option might be to generate separate files and then combine using the standard copy at the command prompt.

    Andy

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

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