Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Creating File With Sql Query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-09-14 : 09:39:16
Juan writes "Juan writes "Hahaha, i think this is a hard one!!!

I need to create a File BUT from a Query, not with DTS and Stuff like that... How???

With something like this (If exists)

Select * from Table Into File 'c:\File.ext'

That's All...
Thanks!!!

Juan Esteban
(SQL 2000)
(WIN 2000) --> Mine
(Win 2000 Server) --> SLQ Server""

X002548
Not Just a Number

15586 Posts

Posted - 2006-09-14 : 10:22:44
bcp with QUERYOUT option

Look it up in BOL



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-14 : 10:42:12
may be this:

osql -SServername -E -h-1 -s"," -q"Set Nocount On Select * from SomeTable" -o x.txt


or in the QA,
go to Tools, Options, Results tab
Set Default Results target combo to "Results to file...."
Set Results output format to whatever you wish to
Run the query, provide file name & path when prompted

and BINGO !!!!



Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -