﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Stored Procedure (or) SQL Script Output to Text 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>Sun, 19 May 2013 22:29:48 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>[quote][b]NJ-DBA (10/17/2011)[/b][hr]you could create a OS command job stem andcall sqlcmd from the OS with the header option set like so:sqlcmd -h-1 -i "D:\scriptdir\script.sql" -o "D:\outputdir\outputtext.out"  fairly sure that'll give you what you're looking for.[/quote]just noticed the age of this thread... saw the previous BT ? post... anyhow better late than never?</description><pubDate>Mon, 17 Oct 2011 13:27:11 GMT</pubDate><dc:creator>NJ-DBA</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>you could create a OS command job stem andcall sqlcmd from the OS with the header option set like so:sqlcmd -h-1 -i "D:\scriptdir\script.sql" -o "D:\outputdir\outputtext.out"  fairly sure that'll give you what you're looking for.</description><pubDate>Mon, 17 Oct 2011 13:25:45 GMT</pubDate><dc:creator>NJ-DBA</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>.? BT</description><pubDate>Mon, 17 Oct 2011 13:11:37 GMT</pubDate><dc:creator>brett-531408</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>Wayne,I create a stored procedure and I am executing that stored procedure via job step on the Job Agent creating a text file to an output file location on the advanced tab of the jobstep.However, when the job runs and creates the text file there is heading on top of the text file. (see below) do you know how to get rid of the heading so the first actual record. Job Diet Orders' : Step 1, 'Run Stored Procedure OrderProcedure' : Began Executing 2010-08-11; 27 :11:28                                                                                                                                                                             ---------- ---------- ------------------------- --------------- - ---------- -------------------------------------------------------------------------------- -------- -------- ---------- ---------- -------------------- -------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Thank you for your time.</description><pubDate>Fri, 27 Aug 2010 13:26:19 GMT</pubDate><dc:creator>TurnerC</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>.</description><pubDate>Mon, 04 Jan 2010 11:40:41 GMT</pubDate><dc:creator>Therese Hutcheson</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>[quote][b]Anil Kumar Kurra (4/29/2009)[/b][hr]Hi Charles,   Thanks for the reply. My Stored Procedure contains the cursor. The output of the stored procedure contains all the Logins and their passwords and default database assigned. This all information when i execute on Query Analyser it will display output on the screen. I need to execute this stored procedure from Job scheduler and store the output some where in text file.Can you suggest me How you mention path of the file during execution of stored procedure?Please help me.Thanks,Anil[/quote]I'm talking about executing the stored procedure inside an SSIS package.  The output file is designated in the flat file connection manager.</description><pubDate>Thu, 30 Apr 2009 10:39:11 GMT</pubDate><dc:creator>Greg Charles</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>Well, I don't know what to tell you. This is the method that I use, and the log files from the jobs do contain the output from the procedure. From both print statements, and select statements.</description><pubDate>Wed, 29 Apr 2009 20:54:47 GMT</pubDate><dc:creator>WayneS</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>Hi,  I had tried that method. But in  that output file it is storing the Job executed Successfully.  It is not storing the output of the script.  It is storing Job has executed successfully in that file everytime the job executes.  Please let me know on this.Regards,Anil</description><pubDate>Wed, 29 Apr 2009 20:23:45 GMT</pubDate><dc:creator>Anil Kumar Kurra</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>[quote][b]Anil Kumar Kurra (4/29/2009)[/b][hr]Hi All,   I am having a Stored Procedure Or SQL Script to be attached to Job Scheduler. When this Stored procedure executes it generates some output text. I need to store this output to text file when ever this store Procedure (or) SQL Script executed by job Scheduler.Please help me how to handle this?Thanks,Anil[/quote]I take it that you mean you have a scheduled job to be run by SQL Server Agent, as opposed to a Scheduled Task to be run by the operating system.Open up the job, then open up the step. Go to the advanced tab. Click in the "Output File" and enter the location and filename for the output. Save all changes. When the job is run, it will now pump the output to this file.</description><pubDate>Wed, 29 Apr 2009 20:17:19 GMT</pubDate><dc:creator>WayneS</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>Hi Charles,   Thanks for the reply. My Stored Procedure contains the cursor. The output of the stored procedure contains all the Logins and their passwords and default database assigned. This all information when i execute on Query Analyser it will display output on the screen. I need to execute this stored procedure from Job scheduler and store the output some where in text file.Can you suggest me How you mention path of the file during execution of stored procedure?Please help me.Thanks,Anil</description><pubDate>Wed, 29 Apr 2009 20:03:18 GMT</pubDate><dc:creator>Anil Kumar Kurra</dc:creator></item><item><title>RE: Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>This article [url]http://thiagsundar.wordpress.com/export-data-to-text-file/[/url] discusses several options for this.  Personally, I'd create an SSIS package that executes the stored procedure and has a flat file connection for the destination file.  The package can be executed in a job step.</description><pubDate>Wed, 29 Apr 2009 09:14:10 GMT</pubDate><dc:creator>Greg Charles</dc:creator></item><item><title>Stored Procedure (or) SQL Script Output to Text File</title><link>http://www.sqlservercentral.com/Forums/Topic706607-391-1.aspx</link><description>Hi All,   I am having a Stored Procedure Or SQL Script to be attached to Job Scheduler. When this Stored procedure executes it generates some output text. I need to store this output to text file when ever this store Procedure (or) SQL Script executed by job Scheduler.Please help me how to handle this?Thanks,Anil</description><pubDate>Wed, 29 Apr 2009 04:16:56 GMT</pubDate><dc:creator>Anil Kumar Kurra</dc:creator></item></channel></rss>