﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Administering / SQL Server 2005  / create a stored procedure to create a txt file / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 25 May 2013 00:21:35 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: create a stored procedure to create a txt file</title><link>http://www.sqlservercentral.com/Forums/Topic907575-146-1.aspx</link><description>Why not use an SSIS package to generate the file?</description><pubDate>Thu, 03 Mar 2011 06:05:49 GMT</pubDate><dc:creator>Steve-3_5_7_9</dc:creator></item><item><title>RE: create a stored procedure to create a txt file</title><link>http://www.sqlservercentral.com/Forums/Topic907575-146-1.aspx</link><description>A little more information would be nice as to what the big picture of this is... Is the parameter some data that needs to be retrieved from SQL?  I could whip out a VBS script to hit the DB, grab the value, and pump it into the script. Powershell possibly?</description><pubDate>Wed, 02 Mar 2011 10:31:46 GMT</pubDate><dc:creator>Mad Myche</dc:creator></item><item><title>RE: create a stored procedure to create a txt file</title><link>http://www.sqlservercentral.com/Forums/Topic907575-146-1.aspx</link><description>The file will be created from the context of the sql server, so you should be able to write it to any drive or share the sql server has access to.</description><pubDate>Wed, 02 Mar 2011 10:17:51 GMT</pubDate><dc:creator>ZZartin</dc:creator></item><item><title>RE: create a stored procedure to create a txt file</title><link>http://www.sqlservercentral.com/Forums/Topic907575-146-1.aspx</link><description>Hi,  Here the txt file will be created in server. Is it possible to create a file in local machine?</description><pubDate>Wed, 02 Mar 2011 09:39:09 GMT</pubDate><dc:creator>RamG</dc:creator></item><item><title>RE: create a stored procedure to create a txt file</title><link>http://www.sqlservercentral.com/Forums/Topic907575-146-1.aspx</link><description>You can use sp_OACreate to access the the File System Object (Active X)[url=http://www.simple-talk.com/sql/t-sql-programming/reading-and-writing-files-in-sql-server-using-t-sql/]reading &amp; writing files in sql server[/url]</description><pubDate>Fri, 08 Oct 2010 08:57:49 GMT</pubDate><dc:creator>Mad Myche</dc:creator></item><item><title>RE: create a stored procedure to create a txt file</title><link>http://www.sqlservercentral.com/Forums/Topic907575-146-1.aspx</link><description>Is there any other way to create store procedure</description><pubDate>Thu, 07 Oct 2010 03:52:25 GMT</pubDate><dc:creator>jain.ashish309</dc:creator></item><item><title>RE: create a stored procedure to create a txt file</title><link>http://www.sqlservercentral.com/Forums/Topic907575-146-1.aspx</link><description>I can't believe this is the slickest way to achieve what you're after, but this works :w00t:[font="Arial Black"]CREATE PROCEDURE EXPORT_DATA@FileName varchar(255)asbegin	declare @bcpCommand varchar(255), @Result int	set @bcpCommand = 'bcp "Select 1 as a" queryout "' + @FileName + '" -c -t, -T -S '	exec @Result = master..xp_cmdshell @bcpCommand, no_outputend[/font]Don't forget that xp_cmdshell is not enabled in the db configuration by defaultMike.</description><pubDate>Fri, 09 Jul 2010 04:12:44 GMT</pubDate><dc:creator>Mike Seddon</dc:creator></item><item><title>create a stored procedure to create a txt file</title><link>http://www.sqlservercentral.com/Forums/Topic907575-146-1.aspx</link><description>Hi,  I need to create a stored procedure that accepts a parameter, this paramentes is a name.   When i pass the name to the stored procedure, this procedure creates a empty  txt file with the name that i passed as the parameter.Is it possible to do this using t-sql?Thank you</description><pubDate>Wed, 21 Apr 2010 03:37:35 GMT</pubDate><dc:creator>river1</dc:creator></item></channel></rss>