Trouble with SQL output to a file

  • Having trouble with directing SQL output sent to a file from command line as well as batch file in SQL 2000.

    Code:

    osql -S servername -d databasename -U loginname -P password -i inputfile.sql -o outputfile.csv

    In the output file I dont see the statements executed.

    Where am I missing?

    Thanks for your time!

  • OSQL.EXE /n /S "servername" /E /dDBName /i "input script path" /o "output file path

    Hope this helps

    Thanks!!!

    The_SQL_DBA
    MCTS

    "Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives."

  • How do you specify the server name when it is configured as local?

    It gives me cannot open login fails

  • Other options like user login failed to work of what reasons could not get the error output for analysis, but this works.

    \full path\OSQL.EXE /E /d "Dev_db" /i "C:\SQL\dummyexport.sql" /o "C:\SQL\DE.csv"

    Experts has to say if its safe to use with option /E which requires no login and server details.

    Hope this helps someone!

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

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