Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-02-18 : 09:26:11
|
| Ramkumar writes "I want to retrieve the results of a system stored procedure in a text file or xls using bcp. I've tried osql utility but since it is inserting a line at the end of each record(in the output file), the output looks shabby. Can we do it using bcp? Please throw some light on this..Or suggest a better way of doing this" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-02-18 : 09:52:24
|
| You can definitely use bcp or DTS to output the results, and they give you more support for formatting the output. bcp is fairly straightforward, you run it from the command line:bcp "EXECUTE spName" queryout C:\mydatafile.txt -Sserver -Uusername -Ppassword -cThis will output a tab-delimited file (the default column separator is tab). If you want to change it, you can use the -t flag to indicate the separator you want.DTS can also perform simple text output, as well as perform more advanced transformations. Look in Books Online under "bcp" and "DTS" for more information. |
 |
|
|
|
|
|