How to export results of a stored procedure to a txt file

Run this in the DOS command line (arguments are case sensitive)

osql /U sa /P password /d pubs /S Server9 /Q "sp_help" -o ofile.txt

Source: https://weblogs.sqlteam.com/mladenp/2005/08/01/7421/
Viewed 12595 times