 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Output errors from SQL Server stored procedure</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 12:30:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: spionred</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/#comment-62760</link>
		<dc:creator>spionred</dc:creator>
		<pubDate>Sun, 26 Apr 2009 20:00:58 +0000</pubDate>
		<guid isPermaLink="false">#comment-62760</guid>
		<description><![CDATA[Thanks,

I will give that a try.

Kevin.]]></description>
		<content:encoded><![CDATA[<p>Thanks,</p>
<p>I will give that a try.</p>
<p>Kevin.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mrdenny</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/#comment-62752</link>
		<dc:creator>mrdenny</dc:creator>
		<pubDate>Sun, 26 Apr 2009 04:28:01 +0000</pubDate>
		<guid isPermaLink="false">#comment-62752</guid>
		<description><![CDATA[In SQL Server you can create a table variable and put the error information into that table variable.  Then after committing or rolling back your transaction you can take the data from the table variable and put it into an actual table.

There isn&#039;t any way to output from a stored procedure to a text file directly.]]></description>
		<content:encoded><![CDATA[<p>In SQL Server you can create a table variable and put the error information into that table variable.  Then after committing or rolling back your transaction you can take the data from the table variable and put it into an actual table.</p>
<p>There isn&#8217;t any way to output from a stored procedure to a text file directly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/#comment-62721</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Fri, 24 Apr 2009 18:49:49 +0000</pubDate>
		<guid isPermaLink="false">#comment-62721</guid>
		<description><![CDATA[Interesting, Kccrosser.

It seems that you have many years of experience in Oracle.

That&#039;s valuable.]]></description>
		<content:encoded><![CDATA[<p>Interesting, Kccrosser.</p>
<p>It seems that you have many years of experience in Oracle.</p>
<p>That&#8217;s valuable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kccrosser</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/#comment-62715</link>
		<dc:creator>kccrosser</dc:creator>
		<pubDate>Fri, 24 Apr 2009 15:39:03 +0000</pubDate>
		<guid isPermaLink="false">#comment-62715</guid>
		<description><![CDATA[Ref the autonomous transactions - this was in a system we built in 1997-2000 on Oracle 7, so those weren&#039;t an option.  We wound up with a little over 1 million lines of PL/SQL code in lots of layers, and needed a way to log errors (and debug and stats, etc.) without worrying about whether there was a transaction in progress.

With the DBMS_PIPE package, it was trivial to create a simple log procedure that anything could call and pass the data to the logging table.]]></description>
		<content:encoded><![CDATA[<p>Ref the autonomous transactions &#8211; this was in a system we built in 1997-2000 on Oracle 7, so those weren&#8217;t an option.  We wound up with a little over 1 million lines of PL/SQL code in lots of layers, and needed a way to log errors (and debug and stats, etc.) without worrying about whether there was a transaction in progress.</p>
<p>With the DBMS_PIPE package, it was trivial to create a simple log procedure that anything could call and pass the data to the logging table.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: spionred</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/#comment-62672</link>
		<dc:creator>spionred</dc:creator>
		<pubDate>Thu, 23 Apr 2009 21:09:45 +0000</pubDate>
		<guid isPermaLink="false">#comment-62672</guid>
		<description><![CDATA[Thanks for the advice.

I will report back when I have cracked it.

Cheers,
kevin.]]></description>
		<content:encoded><![CDATA[<p>Thanks for the advice.</p>
<p>I will report back when I have cracked it.</p>
<p>Cheers,<br />
kevin.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/#comment-62666</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Thu, 23 Apr 2009 19:08:24 +0000</pubDate>
		<guid isPermaLink="false">#comment-62666</guid>
		<description><![CDATA[In Oracle you could also use autonomous transactions, so you can commit the error log separately.]]></description>
		<content:encoded><![CDATA[<p>In Oracle you could also use autonomous transactions, so you can commit the error log separately.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kccrosser</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/#comment-62647</link>
		<dc:creator>kccrosser</dc:creator>
		<pubDate>Thu, 23 Apr 2009 16:06:58 +0000</pubDate>
		<guid isPermaLink="false">#comment-62647</guid>
		<description><![CDATA[Keep in mind one common &quot;gotcha&quot; when dealing with error logging.

If the procedure is called from within a transaction, or if the failing statement is occurring inside a transaction, and you need to do a rollback to maintain the overall transaction integrity, there is no way to write the log record to a table, as that write will also be rolled back.

I solved this in an Oracle system using the dbms_pipe package.  With dbms_pipe, you can create a &quot;listener&quot; process to receive and log messages, and pipe messages are not rolled back in transactions, so when an error occurs in a transaction, simply &quot;pipe&quot; the log information over to the listener to record it, and then execute the rollback to ensure transaction integrity.]]></description>
		<content:encoded><![CDATA[<p>Keep in mind one common &#8220;gotcha&#8221; when dealing with error logging.</p>
<p>If the procedure is called from within a transaction, or if the failing statement is occurring inside a transaction, and you need to do a rollback to maintain the overall transaction integrity, there is no way to write the log record to a table, as that write will also be rolled back.</p>
<p>I solved this in an Oracle system using the dbms_pipe package.  With dbms_pipe, you can create a &#8220;listener&#8221; process to receive and log messages, and pipe messages are not rolled back in transactions, so when an error occurs in a transaction, simply &#8220;pipe&#8221; the log information over to the listener to record it, and then execute the rollback to ensure transaction integrity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: spionred</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/output-erros-from-stored-procedure/#comment-62611</link>
		<dc:creator>spionred</dc:creator>
		<pubDate>Thu, 23 Apr 2009 04:51:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-62611</guid>
		<description><![CDATA[Yeah,

I was hoping to just write to a txt file but I suppose once the process has complete I could query the table from code and output to file from there.]]></description>
		<content:encoded><![CDATA[<p>Yeah,</p>
<p>I was hoping to just write to a txt file but I suppose once the process has complete I could query the table from code and output to file from there.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/10 queries in 0.035 seconds using memcached
Object Caching 365/371 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-24 14:45:59 -->