dbTalk Databases Forums  

Output to text-file

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


Discuss Output to text-file in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kaitsu
 
Posts: n/a

Default Output to text-file - 01-13-2008 , 01:46 AM






How can I get data from table to text-file by SQL-commands, for example
SELECT * FROM Table. Result to text-file Table.txt.




Reply With Quote
  #2  
Old   
Roy Harvey (SQL Server MVP)
 
Posts: n/a

Default Re: Output to text-file - 01-13-2008 , 02:58 AM






On Sun, 13 Jan 2008 07:46:39 GMT, "Kaitsu" <Kaitsu (AT) luukku (DOT) com> wrote:

Quote:
How can I get data from table to text-file by SQL-commands, for example
SELECT * FROM Table. Result to text-file Table.txt.
This must be executed at a command prompt, not as a SQL query.

bcp.exe "select * from master..sysdatabases" queryout
sysdatabases.txt -c -T -t\t -r\n

There are many other parameters to consider, in particular -S to
specify the server, and -f to specify a format file. Read about it in
Books On Line.

Roy Harvey
Beacon Falls, CT


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.