Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Trouble with SQL output to a file Expand / Collapse
Author
Message
Posted Tuesday, October 21, 2008 1:38 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, November 6, 2008 3:30 PM
Points: 15, Visits: 24
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!
Post #589420
Posted Tuesday, October 21, 2008 1:49 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, March 14, 2014 3:15 PM
Points: 802, Visits: 935
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."
Post #589423
Posted Tuesday, October 21, 2008 2:36 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, November 6, 2008 3:30 PM
Points: 15, Visits: 24
How do you specify the server name when it is configured as local?

It gives me cannot open login fails
Post #589454
Posted Tuesday, October 21, 2008 3:34 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, November 6, 2008 3:30 PM
Points: 15, Visits: 24
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!
Post #589477
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse