dbTalk Databases Forums  

Select Records and Insert into Text File?

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


Discuss Select Records and Insert into Text File? in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
junkmail115@gmail.com
 
Posts: n/a

Default Select Records and Insert into Text File? - 09-14-2007 , 12:12 PM






Greetings,

A novice needs some advice:

I am able to bulk insert data from a text file into a table. Is it
possible to run a query and insert the results into a text file on the
local or network hard drive?

Thanks For Reading,
Aaron


Reply With Quote
  #2  
Old   
Jack Vamvas
 
Posts: n/a

Default Re: Select Records and Insert into Text File? - 09-14-2007 , 01:03 PM






One option is to use DTS , check this tutorial which gives you an overview
of the basic concept
http://www.sqldts.com/299.aspx
--

Jack Vamvas
___________________________________
Need an IT job? http://www.ITjobfeed.com




<junkmail115 (AT) gmail (DOT) com> wrote

Quote:
Greetings,

A novice needs some advice:

I am able to bulk insert data from a text file into a table. Is it
possible to run a query and insert the results into a text file on the
local or network hard drive?

Thanks For Reading,
Aaron




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

Default Re: Select Records and Insert into Text File? - 09-14-2007 , 04:36 PM



(junkmail115 (AT) gmail (DOT) com) writes:
Quote:
A novice needs some advice:

I am able to bulk insert data from a text file into a table. Is it
possible to run a query and insert the results into a text file on the
local or network hard drive?
There is no BULK EXPORT that is the inversion of BULK INSERT. You can
spawn the BCP command from xp_cmdshell, but xp_cmdshell is disabled on
SQL 2005 by default, and your DBA may not want to enable it.

Keep in mind that SQL Server is a server application, and it mainly
works with data in the database, and talk with clients over the network.
Things like reading files is mainly a duty for client programs to do.

--
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.