dbTalk Databases Forums  

Output result of query to existing file

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Output result of query to existing file in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mamin@o2.pl
 
Posts: n/a

Default Output result of query to existing file - 05-09-2007 , 03:07 AM






Hi,
I need to output result of my query to txt file. So I'm using -o
parameter, for example:

osql.exe -s (local) -d database1 -U sa -P sa -i 'c:\\queryFile.sql' -o
'c:\\output.txt'

But it clears existing output.txt file first and then outputs the
result, while I need to append the result of my query without clearing
existing file content. Is it possible ?


Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Output result of query to existing file - 05-09-2007 , 05:17 PM






(mamin (AT) o2 (DOT) pl) writes:
Quote:
I need to output result of my query to txt file. So I'm using -o
parameter, for example:

osql.exe -s (local) -d database1 -U sa -P sa -i 'c:\\queryFile.sql' -o
'c:\\output.txt'

But it clears existing output.txt file first and then outputs the
result, while I need to append the result of my query without clearing
existing file content. Is it possible ?
Use >>, the standard append operator in the command-line environment.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.