Return query results to a text file on Hard drive...Newbie Question

Return query results to a text file on Hard drive...Newbie Question

Post by Va » Sun, 09 Dec 2001 04:20:35



Hi,
can anyone tell me how to dump the results of a query to a file in
c:\my documents .... Many thanks.  VanBC
 
 
 

Return query results to a text file on Hard drive...Newbie Question

Post by Paul S Randal [MS » Sun, 09 Dec 2001 04:30:51


Create your script in a text file called blah.sql

If you want the output to be in results.txt, run the following from command
window:

osql /Uuser /Ppassword /i blah.sql /o results.txt

Do 'osql /?' for more options.

--
Paul Randal
DBCC, SQL Server Storage Engine
Microsoft, Redmond, WA

This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:> Hi,
> can anyone tell me how to dump the results of a query to a file in
> c:\my documents .... Many thanks.  VanBC


 
 
 

Return query results to a text file on Hard drive...Newbie Question

Post by va » Sun, 09 Dec 2001 12:38:24


Thanks Paul.  Works a treat!
Van

On Fri, 7 Dec 2001 11:30:51 -0800, "Paul S Randal [MS]"


>Create your script in a text file called blah.sql

>If you want the output to be in results.txt, run the following from command
>window:

>osql /Uuser /Ppassword /i blah.sql /o results.txt

>Do 'osql /?' for more options.

>--
>Paul Randal
>DBCC, SQL Server Storage Engine
>Microsoft, Redmond, WA

>This posting is provided "AS IS" with no warranties, and confers no rights.


>> Hi,
>> can anyone tell me how to dump the results of a query to a file in
>> c:\my documents .... Many thanks.  VanBC