all groups > sql server (alternate) > november 2004 >
You're in the

sql server (alternate)

group:

dumbest question of the day: run a simple query and save the results into a text file


dumbest question of the day: run a simple query and save the results into a text file emebohw NO[at]SPAM netscape.net
11/30/2004 1:37:27 PM
sql server (alternate): Can someone demonstrate a SIMPLE way to do this that does not require
additional functions or stored procedures to be created? Lets say I
want to execute the following simple query - "select * from clients" -
and save the results to a text file, we will assume c:\results.txt

Re: dumbest question of the day: run a simple query and save the results into a text file JD
11/30/2004 4:23:18 PM
Here is one way, from the command line:

isql -S<yourserver>-U<username>-P<password> -Q "select * from clients" -o
output.log

hth


[quoted text, click to view]

Re: dumbest question of the day: run a simple query and save the results into a text file David Rawheiser
12/13/2004 5:04:44 AM
The BCP command line works as well, and you get a little more control over
how the data is saved.

Also there are a boat load of XML functions, if you need data saved in that
format.

[quoted text, click to view]

Re: dumbest question of the day: run a simple query and save the results into a text file abe
12/13/2004 7:04:32 AM
I don't know if you want it to be ad-hoc, but if you do, you can run
the query from Query Analyzer and from the query menu pick "results to
file"
AddThis Social Bookmark Button