Monday, March 19, 2012

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

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

How can I do this in one step?Here is one way, from the command line:

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

hth

"sumGirl" <emebohw@.netscape.net> wrote in message
news:a5e13cff.0411301337.69b2ff44@.posting.google.c om...
> 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
> How can I do this in one step?|||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.

"JD" <joeydba@.yahoo.com> wrote in message news:41acf2d6$1@.news.qgraph.com...
> Here is one way, from the command line:
> isql -S<yourserver>-U<username>-P<password> -Q "select * from clients" -o
> output.log
> hth
>
> "sumGirl" <emebohw@.netscape.net> wrote in message
> news:a5e13cff.0411301337.69b2ff44@.posting.google.c om...
>> 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
>>
>> How can I do this in one step?|||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"

No comments:

Post a Comment