dbTalk Databases Forums  

Stored Procedure - Writeline Where

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


Discuss Stored Procedure - Writeline Where in the comp.databases.ms-sqlserver forum.



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

Default Stored Procedure - Writeline Where - 03-08-2010 , 08:33 AM






I am trying to create a stored procedure to write out to a text file.
I would like it to write a line for each instance of a select
statement. Any help?

Write information Where field1 = String

Reply With Quote
  #2  
Old   
Plamen Ratchev
 
Posts: n/a

Default Re: Stored Procedure - Writeline Where - 03-08-2010 , 09:51 AM






You can use the BCP utility to output the SELECT statement data to a file:
http://msdn.microsoft.com/en-us/libr...6(SQL.80).aspx

Or look at SSIS which may be a better environment for the task:
http://decipherinfosys.wordpress.com...ing-a-package/

--
Plamen Ratchev
http://www.SQLStudio.com

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

Default Re: Stored Procedure - Writeline Where - 03-08-2010 , 06:03 PM



mcolson (mcolson1590 (AT) gmail (DOT) com) writes:
Quote:
I am trying to create a stored procedure to write out to a text file.
I would like it to write a line for each instance of a select
statement. Any help?

Write information Where field1 = String
In addition to Plamen's answer: normally you don't write to text files
from SQL at all. You just return data to the client, and the client
would write to the text file. BCP and SSIS that Plamen mentioned are
examples of specialised such clients that are good of extracting lots
of data.
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: 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.