MSSQL Script execute in .bat

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alfred
    New Member
    • Oct 2006
    • 7

    MSSQL Script execute in .bat

    Hi Guys, anyone out there who could help me with my problem?

    I have created a .bat file that would execute the mssql script and give an .txt file as an output. The script run successfully except for the output, the output save as .txt file was not in order unlike the output that was derrived from the query analyzer. As I try to solve my problem I observe that the lines separating the header and the data was the cause of un-order format, the lines doubles its length when I use the .bat file to execute my script. I have tried using the substring syntax to limit the length but same results achieved. Could anyone help me to remove those line automatically when I run my .bat file?

    Please see the outputs below. Thank you very much.

    output from query analyzer

    object_name counter_name
    ------------------------- -----------------------------------
    SQLServer:Buffe r Manager Buffer cache hit ratio
    SQLServer:Buffe r Manager Buffer cache hit ratio base

    (2 row(s) affected)

    ouput from .bat

    object_name
    counter_name
    --------------------------------------------------
    ----------------------------------------------------------------------
    SQLServer:Buffe r Manager
    Buffer cache hit ratio
    SQLServer:Buffe r Manager
    Buffer cache hit ratio base
  • Alfred
    New Member
    • Oct 2006
    • 7

    #2
    For anyone who will encounter same problem as I did, the solution for my problem was on the .bat file and not in MSSQL. I added the -W in the command in my .bat file.

    Comment

    Working...