<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/4.0.3" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Data Management - Author(s): SQLology ~ Kim Tessereau</title>
		<link>http://blogs.lessthandot.com/index.php/DataMgmt/</link>
		<atom:link rel="self" type="application/rss+xml" href="http://blogs.lessthandot.com/index.php/DataMgmt/?tempskin=_rss2" />
		<description></description>
		<language>en-GB</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=4.0.3"/>
		<ttl>60</ttl>
				<item>
			<title>Removing OS Files Through a Stored Procedure</title>
			<link>http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/removing-os-files-through-a</link>
			<pubDate>Sat, 07 May 2011 13:00:00 +0000</pubDate>			<dc:creator>SQLology ~ Kim Tessereau</dc:creator>
			<category domain="main">Data Modelling &amp; Design</category>
<category domain="alt">Database Programming</category>
<category domain="alt">Database Administration</category>
<category domain="alt">Microsoft SQL Server Admin</category>
<category domain="alt">Microsoft SQL Server</category>			<guid isPermaLink="false">1245@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;&lt;strong&gt;Deleting OS files from a stored procedure:&amp;#160; &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;#160;Here is one way to remove old backup files from the OS through a stored procedure.&amp;#160; The procedure can be compiled in any database.&amp;#160; Once compiled you can run the stored procedure from a scheduled job to remove old backup files from the OS.&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;EXISTS&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; [name] &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; dbo&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;sysobjects&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt; [name] &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;usp_Delete_OS_Files_By_Date&#039;&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;AND&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;TYPE&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;P&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;DROP&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;PROCEDURE&lt;/span&gt; dbo&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;usp_Delete_OS_Files_By_Date&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;GO&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;PROCEDURE&lt;/span&gt; dbo&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;usp_Delete_OS_Files_By_Date&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;@SourceDir &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;255&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt; @SourceFile &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;255&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt; @DaysToKeep &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;AS&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;BEGIN&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;/***********************************************************************************&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;Description:&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Delete operating system files older than n days&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;****&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;Prototype:&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;EXEC dbo.usp_Delete_OS_Files_By_Date&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;@SourceDir = &#039;\\smpprod01\Backups\SGC\&#039;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;, @SourceFile = &#039;SGC_Backup_*&#039;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;, @DaysToKeep = 3&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;**** &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;History&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;****&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;05/06/2011&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt; Kim Tessereau &lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;Created &lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;****&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;************************************************************************************/&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;NOCOUNT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; @CurrentFileDate &lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;@OldFileDate &lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;@SourceDirFOR &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;255&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;@FileName &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;255&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;@DelCommand &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;255&lt;span style=&quot;color: gray;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; @CurrentFileDate &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;getdate&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(),&lt;/span&gt;121&lt;span style=&quot;color: gray;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; @OldFileDate &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;DATEADD&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;dd&lt;span style=&quot;color: gray;&quot;&gt;,-&lt;/span&gt;@DaysToKeep&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;@CurrentFileDate&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;121&lt;span style=&quot;color: gray;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; @SourceDirFOR &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;FOR %I IN (&quot;&#039;&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt; @SourceDir &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt; @SourceFile &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;&quot;) DO @ECHO %~nxtI&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;-- Get OS File information from the OS&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; #Temp_01&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt; [lineorder] &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;IDENTITY&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; [OSInfo] &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;255&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; #Temp_01&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;EXEC&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;master&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;..&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;xp_cmdshell&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;@SourceDirFOR&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;-- Put the OS File info in date order&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TABLE&lt;/span&gt; #Temp_02&lt;span style=&quot;color: blue;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt; [lineorder] &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; [TimeStamp] &lt;span style=&quot;color: blue;&quot;&gt;datetime&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; [FileName] &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;255&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;INSERT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; #Temp_02&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;[lineorder]&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; [Timestamp]&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; [FileName]&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; [lineorder]&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;10&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;SUBSTRING&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;[OSInfo]&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;10&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt; 121&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; [TimeStamp]&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;SUBSTRING&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;[OSInfo]&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;21&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;255&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; [FileName]&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; #Temp_01&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; [OSInfo] &lt;span style=&quot;color: gray;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; [lineorder]&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;&quot;&gt;-- Loop through OS Information and create delete command and execute &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; DeleteCursor &lt;span style=&quot;color: blue;&quot;&gt;CURSOR&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;READ_ONLY&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FOR&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; [FileName]&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; #Temp_02 &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; [TimeStamp] &lt;span style=&quot;color: gray;&quot;&gt;&amp;lt;=&lt;/span&gt; @OldFileDate&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;OPEN&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; DeleteCursor&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;FETCH&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;NEXT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; DeleteCursor &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; @FileName&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;WHILE &lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: fuchsia; font-size: 10pt; mso-no-proof: yes;&quot;&gt;@@fetch_status&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;BEGIN&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;@@fetch_status&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;-&lt;/span&gt;2&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt; @DelCommand &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: red; font-size: 10pt; mso-no-proof: yes;&quot;&gt;DEL&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: red; font-size: 10pt; mso-no-proof: yes;&quot;&gt; /Q &quot;&#039;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt; @SourceDir &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt; @FileName &lt;span style=&quot;color: gray;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;&quot;&#039;&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;EXEC&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;master&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;..&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;xp_cmdshell&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;@DelCommand&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;FETCH&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;NEXT&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; DeleteCursor &lt;span style=&quot;color: blue;&quot;&gt;INTO&lt;/span&gt; @FileName&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;CLOSE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; DeleteCursor&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;DEALLOCATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; DeleteCursor&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;&quot;&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;GO&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/removing-os-files-through-a&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><strong>Deleting OS files from a stored procedure:&#160; </strong></p>
<p>&#160;Here is one way to remove old backup files from the OS through a stored procedure.&#160; The procedure can be compiled in any database.&#160; Once compiled you can run the stored procedure from a scheduled job to remove old backup files from the OS.</p>
<p>&#160;</p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">IF</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: gray;">EXISTS</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: blue;">SELECT</span> [name] <span style="color: blue;">FROM</span> dbo<span style="color: gray;">.</span><span style="color: green;">sysobjects</span> <span style="color: blue;">WHERE</span> [name] <span style="color: gray;">=</span> <span style="color: red;">'usp_Delete_OS_Files_By_Date'</span> <span style="color: gray;">AND</span> <span style="color: blue;">TYPE</span> <span style="color: gray;">=</span> <span style="color: red;">'P'</span><span style="color: gray;">)</span><span style="mso-spacerun: yes;">&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">DROP</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">PROCEDURE</span> dbo<span style="color: gray;">.</span>usp_Delete_OS_Files_By_Date</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">GO</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">CREATE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">PROCEDURE</span> dbo<span style="color: gray;">.</span>usp_Delete_OS_Files_By_Date<span style="color: blue;"> </span><span style="color: gray;">(</span>@SourceDir <span style="color: blue;">varchar</span><span style="color: gray;">(</span>255<span style="color: gray;">),</span> @SourceFile <span style="color: blue;">varchar</span><span style="color: gray;">(</span>255<span style="color: gray;">),</span> @DaysToKeep <span style="color: blue;">int</span><span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">AS</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">BEGIN</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">/***********************************************************************************<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">Description:<span style="mso-spacerun: yes;">&#160; </span>Delete operating system files older than n days<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>****<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">Prototype:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">EXEC dbo.usp_Delete_OS_Files_By_Date<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>@SourceDir = '\\smpprod01\Backups\SGC\'</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>, @SourceFile = 'SGC_Backup_*'</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span>, @DaysToKeep = 3<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>**** </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">History<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>****</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">05/06/2011</span><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;"> Kim Tessereau <span style="mso-tab-count: 1;">&#160;&#160;&#160;&#160; </span>Created <span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span>****</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">************************************************************************************/</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SET</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">NOCOUNT</span> <span style="color: blue;">ON</span><span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">DECLARE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> @CurrentFileDate <span style="color: blue;">char</span><span style="color: gray;">(</span>10<span style="color: gray;">),</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">@OldFileDate <span style="color: blue;">char</span><span style="color: gray;">(</span>10<span style="color: gray;">),</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">@SourceDirFOR <span style="color: blue;">varchar</span><span style="color: gray;">(</span>255<span style="color: gray;">),</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">@FileName <span style="color: blue;">varchar</span><span style="color: gray;">(</span>255<span style="color: gray;">),</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">@DelCommand <span style="color: blue;">varchar</span><span style="color: gray;">(</span>255<span style="color: gray;">);</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SET</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> @CurrentFileDate <span style="color: gray;">=</span> <span style="color: fuchsia;">CONVERT</span><span style="color: gray;">(</span><span style="color: blue;">char</span><span style="color: gray;">(</span>10<span style="color: gray;">),</span><span style="color: fuchsia;">getdate</span><span style="color: gray;">(),</span>121<span style="color: gray;">);</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SET</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> @OldFileDate <span style="color: gray;">=</span> <span style="color: fuchsia;">CONVERT</span><span style="color: gray;">(</span><span style="color: blue;">char</span><span style="color: gray;">(</span>10<span style="color: gray;">),</span><span style="color: fuchsia;">DATEADD</span><span style="color: gray;">(</span>dd<span style="color: gray;">,-</span>@DaysToKeep<span style="color: gray;">,</span>@CurrentFileDate<span style="color: gray;">),</span>121<span style="color: gray;">);</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SET</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> @SourceDirFOR <span style="color: gray;">=</span> <span style="color: red;">'FOR %I IN ("'</span> <span style="color: gray;">+</span> @SourceDir <span style="color: gray;">+</span> @SourceFile <span style="color: gray;">+</span> <span style="color: red;">'") DO @ECHO %~nxtI'</span><span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">-- Get OS File information from the OS</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">CREATE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">TABLE</span> #Temp_01<span style="color: blue;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span></span><span style="color: gray;">(</span> [lineorder] <span style="color: blue;">int</span> <span style="color: blue;">IDENTITY</span><span style="color: gray;">(</span>1<span style="color: gray;">,</span>1<span style="color: gray;">)</span><span style="mso-spacerun: yes;">&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> [OSInfo] <span style="color: blue;">varchar</span><span style="color: gray;">(</span>255<span style="color: gray;">)</span> <span style="color: gray;">);</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">INSERT</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">INTO</span> #Temp_01</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">EXEC</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">master</span><span style="color: gray;">..</span><span style="color: maroon;">xp_cmdshell</span><span style="color: blue;"> </span>@SourceDirFOR<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">-- Put the OS File info in date order</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">CREATE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">TABLE</span> #Temp_02<span style="color: blue;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span></span><span style="color: gray;">(</span> [lineorder] <span style="color: blue;">int</span><span style="mso-spacerun: yes;">&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> [TimeStamp] <span style="color: blue;">datetime</span> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> [FileName] <span style="color: blue;">varchar</span><span style="color: gray;">(</span>255<span style="color: gray;">)</span> <span style="color: gray;">);</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">INSERT</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">INTO</span> #Temp_02<span style="color: blue;"> </span><span style="color: gray;">(</span>[lineorder]<span style="color: gray;">,</span> [Timestamp]<span style="color: gray;">,</span> [FileName]<span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SELECT</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> [lineorder]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> <span style="color: fuchsia;">CONVERT</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: blue;">char</span><span style="color: gray;">(</span>10<span style="color: gray;">),</span><span style="color: fuchsia;">SUBSTRING</span><span style="color: gray;">(</span>[OSInfo]<span style="color: gray;">,</span>1<span style="color: gray;">,</span>10<span style="color: gray;">),</span> 121<span style="color: gray;">)</span> <span style="color: blue;">AS</span> [TimeStamp]<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> <span style="color: fuchsia;">SUBSTRING</span><span style="color: gray;">(</span>[OSInfo]<span style="color: gray;">,</span>21<span style="color: gray;">,</span>255<span style="color: gray;">)</span> <span style="color: blue;">AS</span> [FileName]<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">FROM</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> #Temp_01<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">WHERE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> [OSInfo] <span style="color: gray;">IS</span> <span style="color: gray;">NOT</span> <span style="color: gray;">NULL</span><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes;">&#160;&#160;&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">ORDER</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">BY</span> [lineorder]<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: green; font-size: 10pt; mso-no-proof: yes;">-- Loop through OS Information and create delete command and execute </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">DECLARE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> DeleteCursor <span style="color: blue;">CURSOR</span> <span style="color: blue;">READ_ONLY</span> <span style="color: blue;">FOR</span><span style="mso-spacerun: yes;">&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SELECT</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> [FileName]<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">FROM</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> #Temp_02 </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">WHERE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> [TimeStamp] <span style="color: gray;">&lt;=</span> @OldFileDate<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">OPEN</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> DeleteCursor<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">FETCH</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">NEXT</span> <span style="color: blue;">FROM</span> DeleteCursor <span style="color: blue;">INTO</span> @FileName<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">WHILE </span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">(</span><span style="font-family: &amp;amp;amp; color: fuchsia; font-size: 10pt; mso-no-proof: yes;">@@fetch_status</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: gray;">&lt;&gt;</span> <span style="color: gray;">-</span>1<span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">BEGIN</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">IF </span><span style="color: gray;">(</span><span style="color: fuchsia;">@@fetch_status</span> <span style="color: gray;">&lt;&gt;</span> <span style="color: gray;">-</span>2<span style="color: gray;">)</span><span style="mso-spacerun: yes;">&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">BEGIN</span><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">SET</span> @DelCommand <span style="color: gray;">=</span> <span style="color: red;">'</span></span><span style="font-family: &amp;amp;amp; color: red; font-size: 10pt; mso-no-proof: yes;">DEL</span><span style="font-family: &amp;amp;amp; color: red; font-size: 10pt; mso-no-proof: yes;"> /Q "'</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: gray;">+</span> @SourceDir <span style="color: gray;">+</span> @FileName <span style="color: gray;">+</span> <span style="color: red;">'"'</span><span style="color: gray;">;</span><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">EXEC</span> <span style="color: blue;">master</span><span style="color: gray;">..</span><span style="color: maroon;">xp_cmdshell</span><span style="color: blue;"> </span>@DelCommand<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">END</span><span style="mso-spacerun: yes;">&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">FETCH</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">NEXT</span> <span style="color: blue;">FROM</span> DeleteCursor <span style="color: blue;">INTO</span> @FileName<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">END</span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">CLOSE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> DeleteCursor<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">DEALLOCATE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> DeleteCursor<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">END</span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">GO</span></p>
<p>&#160;</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/removing-os-files-through-a">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/removing-os-files-through-a#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/DataMgmt/?tempskin=_rss2&#38;disp=comments&#38;p=1245</wfw:commentRss>
		</item>
				<item>
			<title>BI Interview Questions....</title>
			<link>http://blogs.lessthandot.com/index.php/DataMgmt/ssis/bi-interview-questions</link>
			<pubDate>Sun, 01 May 2011 14:44:00 +0000</pubDate>			<dc:creator>SQLology ~ Kim Tessereau</dc:creator>
			<category domain="alt">Data Modelling &amp; Design</category>
<category domain="alt">Microsoft SQL Server</category>
<category domain="main">SSIS</category>
<category domain="alt">SSIS</category>			<guid isPermaLink="false">1235@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;Recently I had to find a BI resource to do some ETL work for me.&amp;#160; I wanted to make sure I had the right person for the job so I came up with a list of interview questions that proved out to be spot on.&amp;#160; It really helped me weed out the folks that knew a lot of buzz words versus the folks that had actually worked with the different aspects of the BI ETL process.&amp;#160; I&#039;ve provided some of the answers to a few of the questions.&amp;#160; You would be surprised at what little people really know when they claim to be an expert at BI.&amp;#160; I did find the perfect person using these questions and the project is well under way and on target!&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Can you explain normalization?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;First Normal Form (1NF)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;First normal form (1NF) sets the very basic rules for an organized database:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Eliminate duplicative columns from the same table. &lt;/li&gt;
&lt;li&gt;Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key). &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Second Normal Form (2NF)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Second normal form (2NF) further addresses the concept of removing duplicative data:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Meet all the requirements of the first normal form. &lt;/li&gt;
&lt;li&gt;Remove subsets of data that apply to multiple rows of a table and place them in separate tables. &lt;/li&gt;
&lt;li&gt;Create relationships between these new tables and their predecessors through the use of foreign keys. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Third Normal Form (3NF)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Third normal form (3NF) goes one large step further:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Meet all the requirements of the second normal form. &lt;/li&gt;
&lt;li&gt;Remove columns that are not dependent upon the primary key. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is de-normalization?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is a surrogate key?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Explain what a star schema is?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Explain snow flaking?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What features in SQL Server do you use to tune queries?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Are clustered index scans beneficial to an execution plan?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Can you explain the MERGE command and how it is used?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Performs insert, update, or delete operations on a target table based on the results of a join with a source table. For example, you can synchronize two tables by inserting, updating, or deleting rows in one table based on differences found in the other table.&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Are there any performance issues with having a lot of indexes on a table?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What&amp;#8217;s the difference in using a table variable and a temp table?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The first difference&lt;/strong&gt; is that transaction logs are not recorded for the table variables.&amp;#160; &lt;strong&gt;The second&lt;/strong&gt; major difference is that any procedure with a temporary table cannot be pre-compiled, while an execution plan of procedures with table variables can be statically compiled in advance. Pre-compiling a script gives a major advantage to its speed of execution.&amp;#160; &lt;strong&gt;Finally&lt;/strong&gt;, table variables exist only in the same scope as variables. Contrary to the temporary tables, they are not visible in inner stored procedures and in exec(string) statements.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What are the benefits or detriments to using cursors?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is foreach-loop container?&lt;/strong&gt; Give an example of where it can be used.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;What is a sequence container?&lt;/strong&gt; Give an example of where it can be used.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What task do you use to send an email?&lt;/strong&gt;&amp;#160; Send Mail task.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Mention a few mapping operations that the Character Map transformation supports?&amp;#160;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Character Map transformation applies string functions, such as conversion from lowercase to uppercase, to character data. This transformation operates only on column data with a string data type. The Character Map transformation can convert column data in place or add a column to the transformation output and put the converted data in the new column. You can apply different sets of mapping operations to the same input column and put the results in different columns. For example, you can convert the same column to uppercase and lowercase and put the results in two different columns.&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Explain the functionality of: SCD transformation.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Slowly Changing Dimension transformation provides the following functionality for managing slowly changing dimensions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Matching incoming rows with rows in the lookup table to identify new and existing rows. &lt;/li&gt;
&lt;li&gt;Identifying incoming rows that contain changes when changes are not permitted.&lt;/li&gt;
&lt;li&gt;Identifying inferred member records that require updating.&lt;/li&gt;
&lt;li&gt;Identifying incoming rows that contain historical changes that require insertion of new records and the updating of expired records.&lt;/li&gt;
&lt;li&gt;Detecting incoming rows that contain changes that require the updating of existing records, including expired ones. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;Explain the functionality of: Union All transformation.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;What is the &amp;#8220;Lookup&amp;#8221; transformation used for?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;What is the use of &amp;#8220;package configurations&amp;#8221; in SSIS?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;What are the different ways in which configuration details can be stored?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;How to deploy a package from development server to production server?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;How to deploy packages to file system?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;strong&gt;How to deploy packages to SQL Server? What database will packages be stored?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/DataMgmt/ssis/bi-interview-questions&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Recently I had to find a BI resource to do some ETL work for me.&#160; I wanted to make sure I had the right person for the job so I came up with a list of interview questions that proved out to be spot on.&#160; It really helped me weed out the folks that knew a lot of buzz words versus the folks that had actually worked with the different aspects of the BI ETL process.&#160; I've provided some of the answers to a few of the questions.&#160; You would be surprised at what little people really know when they claim to be an expert at BI.&#160; I did find the perfect person using these questions and the project is well under way and on target!&#160;</p>
<p><strong>Can you explain normalization?</strong></p>
<p><strong>First Normal Form (1NF)</strong></p>
<p>First normal form (1NF) sets the very basic rules for an organized database:</p>
<ul>
<li>Eliminate duplicative columns from the same table. </li>
<li>Create separate tables for each group of related data and identify each row with a unique column or set of columns (the primary key). </li>
</ul>
<p><strong>Second Normal Form (2NF)</strong></p>
<p>Second normal form (2NF) further addresses the concept of removing duplicative data:</p>
<ul>
<li>Meet all the requirements of the first normal form. </li>
<li>Remove subsets of data that apply to multiple rows of a table and place them in separate tables. </li>
<li>Create relationships between these new tables and their predecessors through the use of foreign keys. </li>
</ul>
<p><strong>Third Normal Form (3NF)</strong></p>
<p>Third normal form (3NF) goes one large step further:</p>
<ul>
<li>Meet all the requirements of the second normal form. </li>
<li>Remove columns that are not dependent upon the primary key. </li>
</ul>
<p>&#160;</p>
<p><strong>What is de-normalization?</strong></p>
<p><strong>What is a surrogate key?</strong></p>
<p><strong>Explain what a star schema is?</strong></p>
<p><strong>Explain snow flaking?</strong></p>
<p><strong>What features in SQL Server do you use to tune queries?</strong></p>
<p><strong>Are clustered index scans beneficial to an execution plan?</strong></p>
<p><strong>Can you explain the MERGE command and how it is used?</strong></p>
<p>Performs insert, update, or delete operations on a target table based on the results of a join with a source table. For example, you can synchronize two tables by inserting, updating, or deleting rows in one table based on differences found in the other table.</p>
<p>&#160;</p>
<p><strong>Are there any performance issues with having a lot of indexes on a table?</strong></p>
<p><strong>What&#8217;s the difference in using a table variable and a temp table?</strong></p>
<p><strong>The first difference</strong> is that transaction logs are not recorded for the table variables.&#160; <strong>The second</strong> major difference is that any procedure with a temporary table cannot be pre-compiled, while an execution plan of procedures with table variables can be statically compiled in advance. Pre-compiling a script gives a major advantage to its speed of execution.&#160; <strong>Finally</strong>, table variables exist only in the same scope as variables. Contrary to the temporary tables, they are not visible in inner stored procedures and in exec(string) statements.</p>
<p><strong>What are the benefits or detriments to using cursors?</strong></p>
<p><strong>What is foreach-loop container?</strong> Give an example of where it can be used.</p>
<p><br /><strong>What is a sequence container?</strong> Give an example of where it can be used.</p>
<p><strong>What task do you use to send an email?</strong>&#160; Send Mail task.</p>
<p><strong>Mention a few mapping operations that the Character Map transformation supports?&#160;</strong></p>
<p>The Character Map transformation applies string functions, such as conversion from lowercase to uppercase, to character data. This transformation operates only on column data with a string data type. The Character Map transformation can convert column data in place or add a column to the transformation output and put the converted data in the new column. You can apply different sets of mapping operations to the same input column and put the results in different columns. For example, you can convert the same column to uppercase and lowercase and put the results in two different columns.</p>
<p>&#160;</p>
<p><strong>Explain the functionality of: SCD transformation.</strong></p>
<p>The Slowly Changing Dimension transformation provides the following functionality for managing slowly changing dimensions:</p>
<ul>
<li>Matching incoming rows with rows in the lookup table to identify new and existing rows. </li>
<li>Identifying incoming rows that contain changes when changes are not permitted.</li>
<li>Identifying inferred member records that require updating.</li>
<li>Identifying incoming rows that contain historical changes that require insertion of new records and the updating of expired records.</li>
<li>Detecting incoming rows that contain changes that require the updating of existing records, including expired ones. </li>
</ul>
<p><br /><strong>Explain the functionality of: Union All transformation.</strong></p>
<p><br /><strong>What is the &#8220;Lookup&#8221; transformation used for?</strong></p>
<p><br /><strong>What is the use of &#8220;package configurations&#8221; in SSIS?</strong></p>
<p><br /><strong>What are the different ways in which configuration details can be stored?</strong></p>
<p><br /><strong>How to deploy a package from development server to production server?</strong></p>
<p><br /><strong>How to deploy packages to file system?</strong></p>
<p><br /><strong>How to deploy packages to SQL Server? What database will packages be stored?</strong></p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p><br /><br /></p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/DataMgmt/ssis/bi-interview-questions">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/DataMgmt/ssis/bi-interview-questions#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/DataMgmt/?tempskin=_rss2&#38;disp=comments&#38;p=1235</wfw:commentRss>
		</item>
				<item>
			<title>Why do we need error handling?</title>
			<link>http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/why-do-we-need-error</link>
			<pubDate>Sun, 17 Apr 2011 06:00:00 +0000</pubDate>			<dc:creator>SQLology ~ Kim Tessereau</dc:creator>
			<category domain="main">Database Programming</category>
<category domain="alt">Database Administration</category>
<category domain="alt">Microsoft SQL Server</category>			<guid isPermaLink="false">1198@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;&lt;strong&gt;Why do we need error handling?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;Error handling is something that is often forgot or misunderstood or put off until something goes&amp;#160;awry and we try to back peddle and retro fit the error handling logic in the script, stored procedure or function.&amp;#160;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;I think there are quite a few reasons we should engage in handling something other than the happy path of logic.&amp;#160; I&amp;#8217;ve listed a few here and I&amp;#8217;m sure you can think of some more.&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Inform calling process of situation:&amp;#160; &lt;/strong&gt;I&amp;#8217;m going to pretend, just for a short moment, that I&amp;#8217;m a developer.&amp;#160; Let&amp;#8217;s say I&amp;#8217;m tasked with the job of writing some new functionality in an existing system.&amp;#160; I want to be efficient and reuse some of the existing stored procedures already written in the system.&amp;#160; So I start looking at some of the logic with the procs and I realize that I can&amp;#8217;t tell what the business rules are for a given process because there isn&amp;#8217;t any controls, error handling, that helps me understand what is acceptable as far as data values are concerned.&amp;#160; So the calling process that I would be writing would only know about the happy path and not the so called &amp;#8220;roads less traveled&amp;#8221;.&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Assist in handling transactions:&lt;/strong&gt;&amp;#160; The first thing that comes to mind when I think about a transaction is an old example of the ATM machine transactions.&amp;#160; Let&amp;#8217;s say that you are going to transfer $100 from your checking account to your saving account.&amp;#160; If you looked at the code to do this it would probably look something like this&amp;#8230;.&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; UPDATE checking&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SET balance = balance - @transfer_amount&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; WHERE account = @checking_account&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; UPDATE savings&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SET balance= balance + @transfer_amount&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; WHERE account = @savings_account&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;If these two UPDATE statements are run without any transaction or error handling logic enforced and the first one is successful and the second one fails, then it is going to only withdraw the money from the checking account and the process will stop and return an error to the call process, but the calling process won&amp;#8217;t know what actually happened?&amp;#160; Did the transfer successfully take place?&amp;#160;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Alert user there is a problem:&lt;/strong&gt;&amp;#160; One thing that I think unnerves a user more than anything is to receive an error that is totally cryptic to them.&amp;#160; And I can&amp;#8217;t think of any couple of errors that sounds worse than &amp;#8220;a constraint has been violated&amp;#8221; or how about the ever popular, &amp;#8220;you&amp;#8217;ve been chosen as a deadlock victim&amp;#8221;.&amp;#160; Sounds pretty impressive and could only end in disaster for the user.&amp;#160; They have no idea whether or not what they just did became permanent in the database or not.&amp;#160; With providing error logic in cases like this will give the user some idea of what just happened and what they need to do to correct the situation.&amp;#160; They would probably much rather see something like, &amp;#8220;The customer you are trying to add already exists&amp;#8221; or &amp;#8220;System error &amp;#8211; please resubmit your change&amp;#8221;.&amp;#160; These are more descriptive and give the user answer to what happened and to what their next steps are going to be in order to correct the situation.&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Handle unexpected results:&amp;#160; &lt;/strong&gt;It might be difficult to plan for every error that comes up, but we can at least trap the unexpected and try to provide additional information about what was happening as the time of the error.&amp;#160; Additional information may include things like how many rows were affected, did the connection fail, was the previous transaction successful, etc&amp;#8230; That&amp;#8217;s all I have to say about that!&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Helps provide data consistency:&amp;#160; &lt;/strong&gt;Data consistency is part of what is called the ACID test.&amp;#160; By using error handling in conjunction with transactions, whether they are implicit or explicit, it can help to determine whether or not the data being manipulated is consistent or not.&amp;#160; Let&amp;#8217;s brake apart the acronym ACID first.&amp;#160; A = Atomicity, C = Consistency, I = Isolation and D = Durability.&amp;#160; We are taking about the Consistency in this case.&amp;#160; What does it mean to be consistent?&amp;#160; The transaction must provide valid data to be written to the database.&amp;#160; You seen what happened in the above example with the ATM transaction, if the user doesn&amp;#8217;t understand that there was an error and what that error was how can they be assured that the data lives in the database as a correct (consistent) state?&amp;#160;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;There are a lot of constructs in SQL that help to assist us with handing errors.&amp;#160; They range from the following&amp;#8230;&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; @@Error global variable&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; RETURN statement&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; User-defined error messages&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; RAISERROR command&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TRY/CATCH blocks&lt;/p&gt;
&lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; XACT_ABORT&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;
&lt;p&gt;To see more details on these error handling techniques you can catch my new presentation on error handling titled &quot;We ain&#039;t affraid of no errors&quot;,&amp;#160;at the St. Louis SQL Server User Group meeting on June 14&lt;sup&gt;th&lt;/sup&gt;, 2011 and after the presentation my slide deck will be available at &lt;a href=&quot;http://www.stlssug.org/&quot;&gt;http://www.stlssug.org&lt;/a&gt; Hope to see you there!&lt;/p&gt;
&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/why-do-we-need-error&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><strong>Why do we need error handling?</strong></p>
<p>&#160;</p>
<p>Error handling is something that is often forgot or misunderstood or put off until something goes&#160;awry and we try to back peddle and retro fit the error handling logic in the script, stored procedure or function.&#160;</p>
<p>&#160;</p>
<p>I think there are quite a few reasons we should engage in handling something other than the happy path of logic.&#160; I&#8217;ve listed a few here and I&#8217;m sure you can think of some more.</p>
<p>&#160;</p>
<p><strong>Inform calling process of situation:&#160; </strong>I&#8217;m going to pretend, just for a short moment, that I&#8217;m a developer.&#160; Let&#8217;s say I&#8217;m tasked with the job of writing some new functionality in an existing system.&#160; I want to be efficient and reuse some of the existing stored procedures already written in the system.&#160; So I start looking at some of the logic with the procs and I realize that I can&#8217;t tell what the business rules are for a given process because there isn&#8217;t any controls, error handling, that helps me understand what is acceptable as far as data values are concerned.&#160; So the calling process that I would be writing would only know about the happy path and not the so called &#8220;roads less traveled&#8221;.</p>
<p>&#160;</p>
<p><strong>Assist in handling transactions:</strong>&#160; The first thing that comes to mind when I think about a transaction is an old example of the ATM machine transactions.&#160; Let&#8217;s say that you are going to transfer $100 from your checking account to your saving account.&#160; If you looked at the code to do this it would probably look something like this&#8230;.</p>
<p>&#160;</p>
<p>&#160;&#160;&#160;&#160; UPDATE checking</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SET balance = balance - @transfer_amount</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WHERE account = @checking_account</p>
<p>&#160;</p>
<p>&#160;&#160;&#160;&#160; UPDATE savings</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SET balance= balance + @transfer_amount</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; WHERE account = @savings_account</p>
<p>&#160;</p>
<p>If these two UPDATE statements are run without any transaction or error handling logic enforced and the first one is successful and the second one fails, then it is going to only withdraw the money from the checking account and the process will stop and return an error to the call process, but the calling process won&#8217;t know what actually happened?&#160; Did the transfer successfully take place?&#160;</p>
<p>&#160;</p>
<p><strong>Alert user there is a problem:</strong>&#160; One thing that I think unnerves a user more than anything is to receive an error that is totally cryptic to them.&#160; And I can&#8217;t think of any couple of errors that sounds worse than &#8220;a constraint has been violated&#8221; or how about the ever popular, &#8220;you&#8217;ve been chosen as a deadlock victim&#8221;.&#160; Sounds pretty impressive and could only end in disaster for the user.&#160; They have no idea whether or not what they just did became permanent in the database or not.&#160; With providing error logic in cases like this will give the user some idea of what just happened and what they need to do to correct the situation.&#160; They would probably much rather see something like, &#8220;The customer you are trying to add already exists&#8221; or &#8220;System error &#8211; please resubmit your change&#8221;.&#160; These are more descriptive and give the user answer to what happened and to what their next steps are going to be in order to correct the situation.</p>
<p>&#160;</p>
<p><strong>Handle unexpected results:&#160; </strong>It might be difficult to plan for every error that comes up, but we can at least trap the unexpected and try to provide additional information about what was happening as the time of the error.&#160; Additional information may include things like how many rows were affected, did the connection fail, was the previous transaction successful, etc&#8230; That&#8217;s all I have to say about that!</p>
<p>&#160;</p>
<p><strong>Helps provide data consistency:&#160; </strong>Data consistency is part of what is called the ACID test.&#160; By using error handling in conjunction with transactions, whether they are implicit or explicit, it can help to determine whether or not the data being manipulated is consistent or not.&#160; Let&#8217;s brake apart the acronym ACID first.&#160; A = Atomicity, C = Consistency, I = Isolation and D = Durability.&#160; We are taking about the Consistency in this case.&#160; What does it mean to be consistent?&#160; The transaction must provide valid data to be written to the database.&#160; You seen what happened in the above example with the ATM transaction, if the user doesn&#8217;t understand that there was an error and what that error was how can they be assured that the data lives in the database as a correct (consistent) state?&#160;</p>
<p>&#160;</p>
<p>There are a lot of constructs in SQL that help to assist us with handing errors.&#160; They range from the following&#8230;</p>
<p>&#160;</p>
<p>&#160;&#160;&#160;&#160; @@Error global variable</p>
<p>&#160;&#160;&#160;&#160; RETURN statement</p>
<p>&#160;&#160;&#160;&#160; User-defined error messages</p>
<p>&#160;&#160;&#160;&#160; RAISERROR command</p>
<p>&#160;&#160;&#160;&#160; TRY/CATCH blocks</p>
<p>&#160;&#160;&#160;&#160; XACT_ABORT</p>
<p>&#160;</p>
<p>To see more details on these error handling techniques you can catch my new presentation on error handling titled "We ain't affraid of no errors",&#160;at the St. Louis SQL Server User Group meeting on June 14<sup>th</sup>, 2011 and after the presentation my slide deck will be available at <a href="http://www.stlssug.org/">http://www.stlssug.org</a> Hope to see you there!</p>
<p>&#160;</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/why-do-we-need-error">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/why-do-we-need-error#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/DataMgmt/?tempskin=_rss2&#38;disp=comments&#38;p=1198</wfw:commentRss>
		</item>
				<item>
			<title>Observing - Optimize for Ad Hoc Workload server option</title>
			<link>http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/observing-optimize-for-ad-hoc</link>
			<pubDate>Sat, 09 Apr 2011 11:26:00 +0000</pubDate>			<dc:creator>SQLology ~ Kim Tessereau</dc:creator>
			<category domain="main">Database Administration</category>
<category domain="alt">Microsoft SQL Server Admin</category>
<category domain="alt">Microsoft SQL Server</category>			<guid isPermaLink="false">1189@http://blogs.lessthandot.com/</guid>
						<description>&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: 11pt;&quot;&gt;Optimize For Ad Hoc Workloads &amp;#8211; Observations......&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: 11pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;I&amp;#8217;ve been watching this one particular server that has been throwing alerts for high physical memory usage from Red Gate&amp;#8217;s SQL Monitoring tool.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;I was discussing this with a friend of mine, Clayton Hoyt and he mentioned that I might want to look at the &amp;#8220;Optimize for Ad Hoc Workloads&amp;#8221; advanced server configuration options.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;I took him up on his advice and googled for the &amp;#8220;Optimize For Ad Hoc Workloads&amp;#8221; and &amp;#8220;SQLSkills&amp;#8221;.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;I found a wonderful article from Kimberly Tripp on just this topic.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Here is the link.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: 11pt;&quot;&gt;&amp;#160;&lt;a href=&quot;http://www.sqlskills.com/blogs/kimberly/post/procedure-cache-and-optimizing-for-adhoc-workloads.aspx&quot;&gt;http://www.sqlskills.com/blogs/kimberly/post/procedure-cache-and-optimizing-for-adhoc-workloads.aspx&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: Calibri; font-size: 11pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;The article suggests running the below query to determine the number of plans in cache and the total space that they are taking up.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;So I ran the query on my memory hungry server and the following is what happened......&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; objtype &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; [CacheType]&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;count_big&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(*)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; [Total Plans]&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;cast&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;size_in_bytes &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;decimal&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;18&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;2&lt;span style=&quot;color: gray;&quot;&gt;)))/&lt;/span&gt;1024&lt;span style=&quot;color: gray;&quot;&gt;/&lt;/span&gt;1024 &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; [Total MBs]&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;avg&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;usecounts&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; [Avg Use Count]&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;cast&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; usecounts &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; 1 &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; size_in_bytes &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; 0 &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;decimal&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;18&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;2&lt;span style=&quot;color: gray;&quot;&gt;)))/&lt;/span&gt;1024&lt;span style=&quot;color: gray;&quot;&gt;/&lt;/span&gt;1024 &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; [Total MBs - USE Count 1]&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;sum&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CASE&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt; usecounts &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; 1 &lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt; 1 &lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt; 0 &lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt; [Total Plans - USE Count 1]&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: green;&quot;&gt;sys&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;dm_exec_cached_plans&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;GROUP&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; objtype&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt; [Total MBs - USE Count 1] &lt;span style=&quot;color: blue;&quot;&gt;DESC&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;go&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;Initial Query Results:&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;This is what I started with.&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;CacheType&amp;#160;&amp;#160;&amp;#160;Total Plans&amp;#160;&amp;#160; Total MBs&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Avg Use Count Total MBs - USE Count 1&amp;#160;&amp;#160;Total Plans&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;----------- ------------- ------------- ------------- ------------------------ ------------&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; background: yellow; font-size: 8pt; mso-highlight: yellow;&quot;&gt;Adhoc&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 32750&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;2352.641181&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;927&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 947.289619&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 9167&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;Proc&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;842&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 387.390625&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;169428&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 6.882812&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 29&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;Prepared&amp;#160;&amp;#160;&amp;#160;&amp;#160;576&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 69.460937&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;#160;&amp;#160;&amp;#160;&amp;#160;15176&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 6.234375&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 64&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;Trigger&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;35&amp;#160; &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;21.867187&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;6154&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0.828125&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 3&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;Check&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;31&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0.812500&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;11453&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0.023437&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;View &amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;327&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 36.875000&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;8057&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0.000000&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;UsrTab&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;4&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0.468750&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1473&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 0.000000&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;0&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Then I turned on &amp;#8220;Optimized for Ad Hoc Workload&amp;#8221; and watched the total number of plans decrease along with the total amount of space depleat.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;I kept monitoring during this time as well using SQL Monitor and the only thing that I noticed was the Buffer Free Pages dropped from 1.7 million to .7 million during this 4 hours I spent watching this server.&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;4 hours had passed, Query Results:&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;CacheType&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;Total Plans&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Total MBs&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;Avg Use Count Total MBs - USE Count 1&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;Total Plans&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;----------&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;----------- &lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;------------ ------------- ------------------------- ------------&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; background: yellow; font-size: 8pt; mso-no-proof: yes; mso-highlight: yellow;&quot;&gt;Adhoc&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;42270&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;2264.423034&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;733&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;659.141784&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;11827&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Proc&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;833&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;320.968750&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;173396&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;6.882812&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;29&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Prepared&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;653&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;84.187500&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;13557&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;2.773437&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;26&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Trigger&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;35&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;21.453125&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;6624&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.609375&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;2&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Check&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;31&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.812500&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;11582&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.023437&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;View&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;327&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;36.875000&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;8159&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.000000&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;UsrTab&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;4&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.468750&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;1490&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.000000&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;Then I decided instead of waiting for the server to slowly correct itself I would go ahead and issue &lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;DBCC&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; FREEPROCCACHE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt; to clear the procedure cache.&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;After DBCC command had run, Query Results:&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;CacheType&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Total Plans&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;Total MBs&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;Avg Use Count Total MBs - USE Count 1&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;Total Plans&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;---------- ------------- ------------ ------------- -------------------------- ------------&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Proc&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;70&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;21.031250&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;20&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;5.804687&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;17&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; background: yellow; font-size: 8pt; mso-no-proof: yes; mso-highlight: yellow;&quot;&gt;Adhoc&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;215&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;5.745986&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;3&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.691299&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;128&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Prepared&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;21&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;1.625000&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;5&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.523437&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;9&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Trigger&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;3&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&lt;/span&gt;1.140625&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;6&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.382812&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;1&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;View&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;28&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;1.656250&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;8&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.000000&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Buffer Free Pages climbing from .7 million to 1.1 million. I thought I would see Buffer Free Pages go through the roof, but I&amp;#8217;m guessing that data cache stepped in and took over what had become available.&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;What I expect to see in the next 12 hours is that the total plans and total MB&amp;#8217;s will grow again, but not to the size that it was in the first query.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;I&amp;#8217;m going to bed now and I&amp;#8217;ll check the server in the morning&amp;#8230;&amp;#8230;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;And...I&amp;#8217;m back... &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;Results 12 hours after cache was cleared:&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;CacheType&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Total Plans&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;Total MBs&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;Avg Use Count Total MBs - USE Count 1&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;Total Plans&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;---------- ------------- ------------ ------------- ----------------------------- ------------&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; background: yellow; font-size: 8pt; mso-no-proof: yes; mso-highlight: yellow;&quot;&gt;Adhoc&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;61025&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;1456.307067&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;8&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;523.744567&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;46369&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Proc&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;348&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;138.406250&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;4961&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;8.828125&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;/span&gt;40&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Prepared&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;615&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;76.601562&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;279&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;3.718750&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;46&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Check&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;32&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.781250&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;279&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.218750&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;11&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;Trigger&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;16&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;6.398437&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;1247&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.000000&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;View&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;322&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;30.742187&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;299&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.000000&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt; mso-no-proof: yes;&quot;&gt;UsrTab&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;3&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.250000&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;48&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0.000000&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;0&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;Conclusion:&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;The total number of Adhoc plans in cache were higher than the original baseline, however, the space being used for Adhoc plans was significantly less with the &amp;#8220;Optimize For Ad Hoc Workloads&amp;#8221; configuration option set on.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Because this server houses databases that are accessed with an unusual amount of Adhoc queries I will leave this option on.&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 8pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/observing-optimize-for-ad-hoc&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri; font-size: 11pt;">Optimize For Ad Hoc Workloads &#8211; Observations......</span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: Calibri; font-size: 11pt;">&#160;</span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">I&#8217;ve been watching this one particular server that has been throwing alerts for high physical memory usage from Red Gate&#8217;s SQL Monitoring tool.<span style="mso-spacerun: yes;">&#160; </span>I was discussing this with a friend of mine, Clayton Hoyt and he mentioned that I might want to look at the &#8220;Optimize for Ad Hoc Workloads&#8221; advanced server configuration options.<span style="mso-spacerun: yes;">&#160; </span>I took him up on his advice and googled for the &#8220;Optimize For Ad Hoc Workloads&#8221; and &#8220;SQLSkills&#8221;.<span style="mso-spacerun: yes;">&#160; </span>I found a wonderful article from Kimberly Tripp on just this topic.<span style="mso-spacerun: yes;">&#160; </span>Here is the link.</span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">&#160;</span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: 11pt;">&#160;<a href="http://www.sqlskills.com/blogs/kimberly/post/procedure-cache-and-optimizing-for-adhoc-workloads.aspx">http://www.sqlskills.com/blogs/kimberly/post/procedure-cache-and-optimizing-for-adhoc-workloads.aspx</a></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: Calibri; font-size: 11pt;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">The article suggests running the below query to determine the number of plans in cache and the total space that they are taking up.<span style="mso-spacerun: yes;">&#160; </span>So I ran the query on my memory hungry server and the following is what happened......</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SELECT</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> objtype <span style="color: blue;">AS</span> [CacheType]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> <span style="color: fuchsia;">count_big</span><span style="color: gray;">(*)</span> <span style="color: blue;">AS</span> [Total Plans]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> <span style="color: fuchsia;">sum</span><span style="color: gray;">(</span><span style="color: fuchsia;">cast</span><span style="color: gray;">(</span>size_in_bytes <span style="color: blue;">as</span> <span style="color: blue;">decimal</span><span style="color: gray;">(</span>18<span style="color: gray;">,</span>2<span style="color: gray;">)))/</span>1024<span style="color: gray;">/</span>1024 <span style="color: blue;">AS</span> [Total MBs]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> <span style="color: fuchsia;">avg</span><span style="color: gray;">(</span>usecounts<span style="color: gray;">)</span> <span style="color: blue;">AS</span> [Avg Use Count]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> <span style="color: fuchsia;">sum</span><span style="color: gray;">(</span><span style="color: fuchsia;">cast</span><span style="color: gray;">((</span><span style="color: blue;">CASE</span> <span style="color: blue;">WHEN</span> usecounts <span style="color: gray;">=</span> 1 <span style="color: blue;">THEN</span> size_in_bytes <span style="color: blue;">ELSE</span> 0 <span style="color: blue;">END</span><span style="color: gray;">)</span> <span style="color: blue;">as</span> <span style="color: blue;">decimal</span><span style="color: gray;">(</span>18<span style="color: gray;">,</span>2<span style="color: gray;">)))/</span>1024<span style="color: gray;">/</span>1024 <span style="color: blue;">AS</span> [Total MBs - USE Count 1]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: gray;">,</span> <span style="color: fuchsia;">sum</span><span style="color: gray;">(</span><span style="color: blue;">CASE</span> <span style="color: blue;">WHEN</span> usecounts <span style="color: gray;">=</span> 1 <span style="color: blue;">THEN</span> 1 <span style="color: blue;">ELSE</span> 0 <span style="color: blue;">END</span><span style="color: gray;">)</span> <span style="color: blue;">AS</span> [Total Plans - USE Count 1]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">FROM</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: green;">sys</span><span style="color: gray;">.</span><span style="color: green;">dm_exec_cached_plans</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">GROUP</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">BY</span> objtype</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">ORDER</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">BY</span> [Total MBs - USE Count 1] <span style="color: blue;">DESC</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">go</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">Initial Query Results:<span style="mso-spacerun: yes;">&#160; </span>This is what I started with.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">CacheType&#160;&#160;&#160;Total Plans&#160;&#160; Total MBs&#160;&#160;&#160;&#160;&#160;Avg Use Count Total MBs - USE Count 1&#160;&#160;Total Plans&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">----------- ------------- ------------- ------------- ------------------------ ------------</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; background: yellow; font-size: 8pt; mso-highlight: yellow;">Adhoc&#160;&#160;&#160;&#160;&#160;&#160; 32750&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="mso-spacerun: yes;">&#160;</span>2352.641181&#160;&#160;&#160;&#160;&#160;&#160;&#160;927&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 947.289619&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 9167</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">Proc&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;842&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 387.390625&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;169428&#160;&#160;&#160;&#160;&#160;&#160;&#160; 6.882812&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 29</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">Prepared&#160;&#160;&#160;&#160;576&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 69.460937&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;15176&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 6.234375&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 64</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">Trigger&#160;&#160;&#160;&#160;&#160;35&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;21.867187&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;6154&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0.828125&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 3</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">Check&#160;&#160;&#160;&#160;&#160;&#160;&#160;31&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0.812500&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;11453&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0.023437&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 1</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">View &#160;&#160;&#160;&#160;&#160;&#160;&#160;327&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 36.875000&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;8057&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0.000000&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">UsrTab&#160;&#160;&#160;&#160;&#160;&#160;4&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0.468750&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1473&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 0.000000&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;0</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Then I turned on &#8220;Optimized for Ad Hoc Workload&#8221; and watched the total number of plans decrease along with the total amount of space depleat.<span style="mso-spacerun: yes;">&#160; </span>I kept monitoring during this time as well using SQL Monitor and the only thing that I noticed was the Buffer Free Pages dropped from 1.7 million to .7 million during this 4 hours I spent watching this server.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">4 hours had passed, Query Results:<span style="mso-spacerun: yes;">&#160; </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">CacheType<span style="mso-spacerun: yes;">&#160;&#160; </span>Total Plans<span style="mso-spacerun: yes;">&#160; </span>Total MBs<span style="mso-spacerun: yes;">&#160;&#160;&#160; </span>Avg Use Count Total MBs - USE Count 1<span style="mso-spacerun: yes;">&#160;&#160; </span>Total Plans&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">&#160;</span><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">----------<span style="mso-spacerun: yes;">&#160; </span>----------- <span style="mso-spacerun: yes;">&#160;</span>------------ ------------- ------------------------- ------------</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; background: yellow; font-size: 8pt; mso-no-proof: yes; mso-highlight: yellow;">Adhoc<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160; </span>42270<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes;">&#160;&#160;&#160;</span>2264.423034<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>733<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>659.141784<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>11827</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Proc<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>833<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>320.968750<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>173396<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>6.882812<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>29</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Prepared<span style="mso-spacerun: yes;">&#160;&#160;&#160; </span>653<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>84.187500<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>13557<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>2.773437<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>26</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Trigger<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160; </span>35<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>21.453125<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>6624<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.609375<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>2</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Check<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160; </span>31<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.812500<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>11582<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.023437<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>1</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">View<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>327<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>36.875000<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>8159<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.000000<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">UsrTab<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span>4<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.468750<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>1490<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.000000<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: Times New Roman; font-size: small;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">Then I decided instead of waiting for the server to slowly correct itself I would go ahead and issue </span><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">DBCC</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> FREEPROCCACHE</span><span style="font-family: &amp;amp;amp; font-size: 8pt;"> to clear the procedure cache.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">After DBCC command had run, Query Results:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">CacheType<span style="mso-spacerun: yes;">&#160; </span>Total Plans<span style="mso-spacerun: yes;">&#160;&#160; </span>Total MBs<span style="mso-spacerun: yes;">&#160;&#160;&#160; </span>Avg Use Count Total MBs - USE Count 1<span style="mso-spacerun: yes;">&#160;&#160;&#160; </span>Total Plans</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">---------- ------------- ------------ ------------- -------------------------- ------------</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Proc<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160; </span>70<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>21.031250<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>20<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>5.804687<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>17</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; background: yellow; font-size: 8pt; mso-no-proof: yes; mso-highlight: yellow;">Adhoc<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span>215<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>5.745986<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>3<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.691299<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>128</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Prepared<span style="mso-spacerun: yes;">&#160;&#160; </span>21<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>1.625000<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>5<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.523437<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>9</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Trigger<span style="mso-spacerun: yes;">&#160;&#160;&#160; </span>3<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes;">&#160;</span>1.140625<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>6<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.382812<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>1</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">View<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160; </span>28<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>1.656250<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>8<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.000000<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Buffer Free Pages climbing from .7 million to 1.1 million. I thought I would see Buffer Free Pages go through the roof, but I&#8217;m guessing that data cache stepped in and took over what had become available.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">What I expect to see in the next 12 hours is that the total plans and total MB&#8217;s will grow again, but not to the size that it was in the first query.<span style="mso-spacerun: yes;">&#160; </span>I&#8217;m going to bed now and I&#8217;ll check the server in the morning&#8230;&#8230;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">And...I&#8217;m back... </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">Results 12 hours after cache was cleared:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">CacheType<span style="mso-spacerun: yes;">&#160; </span>Total Plans<span style="mso-spacerun: yes;">&#160;&#160; </span>Total MBs<span style="mso-spacerun: yes;">&#160;&#160;&#160; </span>Avg Use Count Total MBs - USE Count 1<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160; </span>Total Plans</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">---------- ------------- ------------ ------------- ----------------------------- ------------</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; background: yellow; font-size: 8pt; mso-no-proof: yes; mso-highlight: yellow;">Adhoc<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span>61025<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>1456.307067<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>8<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>523.744567<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>46369</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Proc<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160; </span>348<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>138.406250<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>4961<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>8.828125<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span>40</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Prepared<span style="mso-spacerun: yes;">&#160;&#160; </span>615<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>76.601562<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>279<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>3.718750<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>46</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Check<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160; </span>32<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.781250<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>279<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.218750<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>11</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">Trigger<span style="mso-spacerun: yes;">&#160;&#160;&#160; </span>16<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>6.398437<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>1247<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.000000<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">View<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160; </span>322<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>30.742187<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>299<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.000000<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 8pt; mso-no-proof: yes;">UsrTab<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160; </span>3<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.250000<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>48<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0.000000<span style="mso-spacerun: yes;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>0</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">&#160;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">Conclusion:<span style="mso-spacerun: yes;">&#160; </span>The total number of Adhoc plans in cache were higher than the original baseline, however, the space being used for Adhoc plans was significantly less with the &#8220;Optimize For Ad Hoc Workloads&#8221; configuration option set on.<span style="mso-spacerun: yes;">&#160; </span>Because this server houses databases that are accessed with an unusual amount of Adhoc queries I will leave this option on.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 8pt;">&#160;</span></p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/observing-optimize-for-ad-hoc">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/observing-optimize-for-ad-hoc#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/DataMgmt/?tempskin=_rss2&#38;disp=comments&#38;p=1189</wfw:commentRss>
		</item>
				<item>
			<title>We ain't afraid of no errors!</title>
			<link>http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/we-ain-t-afraid-of-1</link>
			<pubDate>Sun, 03 Apr 2011 02:28:00 +0000</pubDate>			<dc:creator>SQLology ~ Kim Tessereau</dc:creator>
			<category domain="main">Database Programming</category>
<category domain="alt">Microsoft SQL Server</category>			<guid isPermaLink="false">1175@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt;&quot;&gt;Good old fashion error handling..........This is something that is often skipped over when we code because we don&#039;t stop and take the time out to plan it out.&amp;#160; I&#039;ve put together a presentation on this topic and I&#039;ll be submitting it to the next SQL Saturday that I attend, but would like to share the main points here.&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Obviously, there is a lot I left out here, don&amp;#8217;t want to spoil the presentation!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; padding-left: 30px; margin-left: 0.25in; mso-list: l0 level1 lfo2;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&amp;#183;&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt;Why do we need error handling?&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;padding-left: 30px;&quot;&gt;&amp;#160;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;&quot;&gt;One of the first things that comes to mind is that the calling process needs to be informed if a stored procedure/script has failed or was successful.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt; It is also used to&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt;control the processing of transactions whether they are implicit or explicit.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt; The user needs to be alerted if there is a problem too.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt; Error handling allows us to be able to code for unexpected results and helps to provide data consistency.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l1 level1 lfo1;&quot;&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span&gt;&lt;strong&gt;&lt;span style=&quot;mso-special-format: bullet;&quot;&gt;&amp;#183;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;@@ERROR Global Variable&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p style=&quot;line-height: 14.25pt; margin-left: 0.25in;&quot;&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman; font-size: small;&quot;&gt;@@ERROR is known as a system variable to SQL Server.&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt; It is read-only and contains the value of the error number that was generated&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt;in the previous transact SQL statement&lt;strong&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; mso-bidi-font-family: +mn-cs; mso-hansi-font-family: Arial;&quot;&gt; that just processed&lt;/span&gt;&lt;/strong&gt;.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt; Every statement is evaluated to determine whether or not it was successful.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt; So for example:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;USE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;master&lt;/span&gt; &lt;span style=&quot;mso-tab-count: 5;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--@@ERROR contains 0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;sysobjects&lt;/span&gt; &lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--@@ERROR contains 0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;USE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; model &lt;span style=&quot;mso-tab-count: 5;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--@@ERROR contains 0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;sysdatabases&lt;/span&gt; &lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--@@ERROR contains 208&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: gray;&quot;&gt;EXISTS&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: green;&quot;&gt;sysservers&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--@@ERROR contains 208&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; 1&lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt;1&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--@@ERROR contains 102&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;@@ERROR&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;gt;&lt;/span&gt; 0 &lt;span style=&quot;mso-tab-count: 4;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--@@ERROR contains 0 &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;GOTO&lt;/span&gt; somewhere &lt;span style=&quot;mso-tab-count: 4;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--@@ERROR contains 0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;somewhere:&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;mso-tab-count: 5;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--@@ERROR contains 0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l2 level1 lfo3;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&amp;#183;&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt;RETURN Statement&lt;/span&gt;&lt;/strong&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; margin-left: 0.25in;&quot;&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;The RETURN statement when executed returns control to the call process unconditionally.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;It returns an integer value.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;A warning will be issued it the value is NULL.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l2 level1 lfo3;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&amp;#183;&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;&quot;&gt;User-Defined Error Messages&lt;/span&gt;&lt;/strong&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; margin-left: 0.25in;&quot;&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;The user-defined error messages are saved in master in sys.messages table.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;They can be used across databases.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;When a user-defined error message is called if can write to the Windows application log.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;The message can be informational or error related, depends on severity level.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Severity level 20 thru 25 are fatal errors &amp;#8211; processing has stopped.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l2 level1 lfo3;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&amp;#183;&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;RAISERROR Statement&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; margin-left: 0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;The RAISERROR statement is used to raise user-defined error messages.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;It can be used to raise dynamically built messages.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;The message is returned as a server message.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;It can also raise messages to a Catch block and insert them into the error and application log.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Here is an example of a RAISERROR statement.&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; @oldname &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;15&lt;span style=&quot;color: gray;&quot;&gt;),&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;@newname &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;(&lt;/span&gt;15&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; @oldname &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;Cato&#039;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; @newname &lt;span style=&quot;color: gray;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#039;Tessereau&#039;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: red; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;RAISERROR &lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;50001&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--user-defined error message number&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;10&lt;span style=&quot;color: gray;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--severity level&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;1&lt;span style=&quot;color: gray;&quot;&gt;,&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--error state&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 3;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;@oldname,&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;@newname&lt;span style=&quot;color: gray;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;WITH&lt;/span&gt; &lt;span style=&quot;color: fuchsia;&quot;&gt;LOG&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l2 level1 lfo3;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&amp;#183;&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;TRY/CATCH Blocks&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt;&quot;&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;These consist of two parts a TRY block and a CATCH block.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Logic control is passed to the CATCH block from the TRY block when an error is encountered.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;They can be nested, but be careful when doing this because the logic can get very confusing the deeper you nest.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Severity 20 or higher not handled by TRY/CATCH because connection is closed.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Severity 10 or less not handled, these are informational only.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Here is an example of a simple TRY/CATCH block.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;PROC&lt;/span&gt; usp_myproc&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;AS&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;--just a silly little proc&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: gray;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;table&lt;/span&gt; that does &lt;span style=&quot;color: gray;&quot;&gt;not&lt;/span&gt; exist&lt;span style=&quot;color: gray;&quot;&gt;&amp;gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;GO&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;BEGIN&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TRY&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;EXEC&lt;/span&gt; usp_myproc&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;TRY&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;BEGIN&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;CATCH&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;ERROR_NUMBER&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; ErrNum&lt;span style=&quot;color: gray;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style=&quot;color: fuchsia;&quot;&gt;ERROR_MESSAGE&lt;/span&gt;&lt;span style=&quot;color: gray;&quot;&gt;()&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; ErrMsg&lt;span style=&quot;color: gray;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt; &lt;span style=&quot;color: blue;&quot;&gt;CATCH&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;&quot;&gt;GO&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt; mso-list: l2 level1 lfo3;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&amp;#183;&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-no-proof: yes;&quot;&gt;XACT_ABORT statement&lt;/span&gt;&lt;/strong&gt;&lt;strong style=&quot;mso-bidi-font-weight: normal;&quot;&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: arial,helvetica,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;&quot;&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;OFF is the default setting.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;#160; &lt;/span&gt;Compile errors are not affected by XACT_ABORT.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; margin: 0in 0in 0pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;When set to ON&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt 0.25in; mso-list: l2 level1 lfo3;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&amp;#183;&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Processing stops when an error is encountered&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt 0.25in; mso-list: l2 level1 lfo3;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&amp;#183;&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;When run-time error is raised, entire transaction is rolled back automatically, no need for ROLLBACK statement.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt 0.25in; mso-list: l2 level1 lfo3;&quot;&gt;&lt;span style=&quot;font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;&amp;#183;&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;When combined with a TRY/CATCH block you get unexpected behavior&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt 0.75in; mso-list: l2 level2 lfo3;&quot;&gt;&lt;span style=&quot;font-family: &amp;amp;amp;amp; font-size: 10pt; mso-fareast-font-family: &#039;Courier New&#039;;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;o&lt;span style=&quot;font: 7pt &amp;amp;amp;amp;&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;&quot;&gt;&lt;span style=&quot;font-family: Times New Roman;&quot;&gt;SQL Server treats statement level errors as batch level errors&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/we-ain-t-afraid-of-1&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p><span style="font-family: &amp;amp;amp; font-size: 10pt;">Good old fashion error handling..........This is something that is often skipped over when we code because we don't stop and take the time out to plan it out.&#160; I've put together a presentation on this topic and I'll be submitting it to the next SQL Saturday that I attend, but would like to share the main points here.</span><span style="font-size: small;"><span style="font-family: Times New Roman;"><span style="mso-spacerun: yes;">&#160; </span>Obviously, there is a lot I left out here, don&#8217;t want to spoil the presentation!</span></span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; padding-left: 30px; margin-left: 0.25in; mso-list: l0 level1 lfo2;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&#183;<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><strong><span style="font-family: arial,helvetica,sans-serif;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;">Why do we need error handling?</span></span></strong></p>
<p style="padding-left: 30px;">&#160;<span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;"><span style="color: #000000;"><span style="language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;">One of the first things that comes to mind is that the calling process needs to be informed if a stored procedure/script has failed or was successful.</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;">&#160;</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;"> It is also used to</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;">&#160;</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;">control the processing of transactions whether they are implicit or explicit.</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;">&#160;</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;"> The user needs to be alerted if there is a problem too.</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;">&#160;</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;"> Error handling allows us to be able to code for unexpected results and helps to provide data consistency.</span></span></span></span></span></p>
<ul>
<li>
<div style="line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l1 level1 lfo1;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="color: #000000;"><span style="font-family: arial,helvetica,sans-serif;"><span><strong><span style="mso-special-format: bullet;">&#183;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>@@ERROR Global Variable</strong></span></span></span></span></span></span></div>
</li>
</ul>
<p style="line-height: 14.25pt; margin-left: 0.25in;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;">&#160;</span></span><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="color: #000000;"><span style="language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;"><span style="color: #000000;"><span style="font-family: Times New Roman; font-size: small;">@@ERROR is known as a system variable to SQL Server.</span></span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;">&#160;</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;"> It is read-only and contains the value of the error number that was generated</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;">&#160;</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;">in the previous transact SQL statement<strong><span style="font-family: &amp;amp;amp; mso-bidi-font-family: +mn-cs; mso-hansi-font-family: Arial;"> that just processed</span></strong>.</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;">&#160;</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;"> Every statement is evaluated to determine whether or not it was successful.</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt;">&#160;</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;"> So for example:</span></span></span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">USE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">master</span> <span style="mso-tab-count: 5;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green;">--@@ERROR contains 0</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 1;">&#160;&#160; </span><span style="color: blue;">SELECT</span> <span style="color: gray;">*</span> <span style="color: blue;">FROM</span> <span style="color: green;">sysobjects</span> <span style="mso-tab-count: 1;">&#160;&#160;&#160;&#160; </span><span style="mso-tab-count: 1;">&#160;&#160;&#160;&#160;&#160; </span><span style="color: green;">--@@ERROR contains 0</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">USE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> model <span style="mso-tab-count: 5;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green;">--@@ERROR contains 0</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 1;">&#160;&#160; </span><span style="color: blue;">SELECT</span> <span style="color: gray;">*</span> <span style="color: blue;">FROM</span> <span style="color: green;">sysdatabases</span> <span style="mso-tab-count: 1;">&#160;&#160; </span><span style="mso-tab-count: 1;">&#160;&#160;&#160;&#160;&#160; </span><span style="color: green;">--@@ERROR contains 208</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">IF</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: gray;">EXISTS</span><span style="color: blue;"> </span><span style="color: gray;">(</span><span style="color: blue;">SELECT</span> <span style="color: gray;">*</span> <span style="color: blue;">FROM</span> <span style="color: green;">sysservers</span><span style="color: gray;">)</span> <span style="mso-tab-count: 1;">&#160; </span><span style="color: green;">--@@ERROR contains 208</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 1;">&#160;&#160; </span><span style="color: blue;">SELECT</span> 1<span style="color: gray;">=</span>1<span style="mso-tab-count: 2;">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-tab-count: 3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green;">--@@ERROR contains 102</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">IF</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: fuchsia;">@@ERROR</span> <span style="color: gray;">&gt;</span> 0 <span style="mso-tab-count: 4;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green;">--@@ERROR contains 0 </span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 1;">&#160;&#160; </span><span style="color: blue;">GOTO</span> somewhere <span style="mso-tab-count: 4;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green;">--@@ERROR contains 0</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">somewhere:</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="mso-tab-count: 5;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: green;">--@@ERROR contains 0</span></span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l2 level1 lfo3;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&#183;<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><strong style="mso-bidi-font-weight: normal;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;">RETURN Statement</span></strong><strong style="mso-bidi-font-weight: normal;"></strong></p>
<p style="line-height: 14.25pt; margin-left: 0.25in;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;">&#160;</span></span><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="color: #000000;"><span style="language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;"><span style="color: #000000;"><span style="font-size: small;"><span style="font-family: Times New Roman;">The RETURN statement when executed returns control to the call process unconditionally.<span style="mso-spacerun: yes;">&#160; </span>It returns an integer value.<span style="mso-spacerun: yes;">&#160; </span>A warning will be issued it the value is NULL.<span style="mso-spacerun: yes;">&#160; </span></span></span></span></span></span></span></span></span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l2 level1 lfo3;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&#183;<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><strong style="mso-bidi-font-weight: normal;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-font-kerning: 12.0pt; mso-hansi-font-family: Arial;">User-Defined Error Messages</span></strong><strong style="mso-bidi-font-weight: normal;"></strong></p>
<p style="line-height: 14.25pt; margin-left: 0.25in;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">&#160;</span></span><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="color: #000000;"><span style="language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;"><span style="color: #000000;"><span style="font-size: small;"><span style="font-family: Times New Roman;">The user-defined error messages are saved in master in sys.messages table.<span style="mso-spacerun: yes;">&#160; </span>They can be used across databases.<span style="mso-spacerun: yes;">&#160; </span>When a user-defined error message is called if can write to the Windows application log.<span style="mso-spacerun: yes;">&#160; </span>The message can be informational or error related, depends on severity level.<span style="mso-spacerun: yes;">&#160; </span>Severity level 20 thru 25 are fatal errors &#8211; processing has stopped.</span></span></span></span></span></span></span></span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l2 level1 lfo3;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&#183;<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><strong style="mso-bidi-font-weight: normal;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">RAISERROR Statement</span></strong></p>
<p style="line-height: 14.25pt; margin-left: 0.25in;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">The RAISERROR statement is used to raise user-defined error messages.<span style="mso-spacerun: yes;">&#160; </span>It can be used to raise dynamically built messages.<span style="mso-spacerun: yes;">&#160; </span>The message is returned as a server message.<span style="mso-spacerun: yes;">&#160; </span>It can also raise messages to a Catch block and insert them into the error and application log.<span style="mso-spacerun: yes;">&#160; </span>Here is an example of a RAISERROR statement.</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">DECLARE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> @oldname <span style="color: blue;">varchar</span><span style="color: gray;">(</span>15<span style="color: gray;">),</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 1;">&#160;&#160; </span><span style="mso-tab-count: 1;">&#160;&#160;&#160;&#160;&#160; </span>@newname <span style="color: blue;">varchar</span><span style="color: gray;">(</span>15<span style="color: gray;">)</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 2;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SET</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> @oldname <span style="color: gray;">=</span> <span style="color: red;">'Cato'</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SET</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> @newname <span style="color: gray;">=</span> <span style="color: red;">'Tessereau'</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: red; font-size: 10pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">RAISERROR </span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">(</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">50001<span style="color: gray;">,</span><span style="mso-spacerun: yes;">&#160; </span><span style="color: green;">--user-defined error message number</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>10<span style="color: gray;">, </span><span style="color: green;">--severity level</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>1<span style="color: gray;">,<span style="mso-spacerun: yes;">&#160; </span></span><span style="color: green;">--error state</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 3;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span>@oldname,</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 0.25in; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 2;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="mso-tab-count: 1;">&#160;&#160;&#160;&#160;&#160; </span>@newname<span style="color: gray;">)</span> <span style="color: blue;">WITH</span> <span style="color: fuchsia;">LOG</span><span style="color: gray;">;</span></span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; margin-left: 0.25in; mso-list: l2 level1 lfo3;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&#183;<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><strong style="mso-bidi-font-weight: normal;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">TRY/CATCH Blocks</span></strong></p>
<p style="line-height: 14.25pt;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">&#160;</span></span><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="color: #000000;"><span style="language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;"><span style="color: #000000;"><span style="font-size: small;"><span style="font-family: Times New Roman;">These consist of two parts a TRY block and a CATCH block.<span style="mso-spacerun: yes;">&#160; </span>Logic control is passed to the CATCH block from the TRY block when an error is encountered.<span style="mso-spacerun: yes;">&#160; </span>They can be nested, but be careful when doing this because the logic can get very confusing the deeper you nest.<span style="mso-spacerun: yes;">&#160; </span>Severity 20 or higher not handled by TRY/CATCH because connection is closed.<span style="mso-spacerun: yes;">&#160; </span>Severity 10 or less not handled, these are informational only.<span style="mso-spacerun: yes;">&#160; </span>Here is an example of a simple TRY/CATCH block.</span></span></span></span></span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">CREATE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">PROC</span> usp_myproc</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">AS</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160; </span><span style="color: green;">--just a silly little proc</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">&#160; </span><span style="color: blue;">SELECT</span> <span style="color: gray;">*</span> <span style="color: blue;">FROM</span> <span style="color: gray;">&lt;</span><span style="color: blue;">table</span> that does <span style="color: gray;">not</span> exist<span style="color: gray;">&gt;;</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">GO</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">&#160;</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">BEGIN</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">TRY</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 1;">&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">EXEC</span> usp_myproc</span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">END</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">TRY</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">BEGIN</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">CATCH</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 1;">&#160;&#160;&#160;&#160;&#160; </span><span style="color: blue;">SELECT</span> </span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 2;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: fuchsia;">ERROR_NUMBER</span><span style="color: gray;">()</span> <span style="color: blue;">as</span> ErrNum<span style="color: gray;">,</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 2;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span><span style="color: fuchsia;">ERROR_MESSAGE</span><span style="color: gray;">()</span> <span style="color: blue;">as</span> ErrMsg<span style="color: gray;">;</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">END</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">CATCH</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">GO</span></p>
<p style="line-height: 14.25pt;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 1;">&#160;&#160;&#160;&#160;&#160; </span></span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt; mso-list: l2 level1 lfo3;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&#183;<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><strong style="mso-bidi-font-weight: normal;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">XACT_ABORT statement</span></strong><strong style="mso-bidi-font-weight: normal;"></strong></p>
<p style="line-height: 14.25pt; margin: 0in 0in 0pt;"><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">&#160;</span></span><span style="font-family: arial,helvetica,sans-serif;"><span style="font-size: x-small;"><span style="color: #000000;"><span style="language: en-US; mso-ascii-font-family: Calibri; mso-fareast-font-family: +mn-ea; mso-bidi-font-family: +mn-cs; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-fareast; mso-bidi-theme-font: minor-bidi; mso-color-index: 3; mso-font-kerning: 12.0pt; mso-style-textfill-type: solid; mso-style-textfill-fill-themecolor: text2; mso-style-textfill-fill-color: #675D59; mso-style-textfill-fill-alpha: 100.0%;"><span style="color: #000000;"><span style="font-size: small;"><span style="font-family: Times New Roman;">OFF is the default setting.<span style="mso-spacerun: yes;">&#160; </span>Compile errors are not affected by XACT_ABORT.</span></span></span></span></span></span></span></span></p>
<p style="line-height: 14.25pt; margin: 0in 0in 0pt;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">When set to ON</span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt 0.25in; mso-list: l2 level1 lfo3;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&#183;<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">Processing stops when an error is encountered</span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt 0.25in; mso-list: l2 level1 lfo3;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&#183;<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">When run-time error is raised, entire transaction is rolled back automatically, no need for ROLLBACK statement.</span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt 0.25in; mso-list: l2 level1 lfo3;"><span style="font-family: Symbol; font-size: 10pt; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">&#183;<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-ascii-theme-font: minor-latin; mso-bidi-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;">When combined with a TRY/CATCH block you get unexpected behavior</span></p>
<p style="line-height: 14.25pt; text-indent: -0.25in; margin: 0in 0in 0pt 0.75in; mso-list: l2 level2 lfo3;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: 'Courier New';"><span style="mso-list: Ignore;">o<span style="font: 7pt &amp;amp;amp;">&#160;&#160;&#160; </span></span></span><span style="font-size: 10pt; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><span style="font-family: Times New Roman;">SQL Server treats statement level errors as batch level errors</span></span></p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/we-ain-t-afraid-of-1">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/we-ain-t-afraid-of-1#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/DataMgmt/?tempskin=_rss2&#38;disp=comments&#38;p=1175</wfw:commentRss>
		</item>
				<item>
			<title>Wow what a week in review.....</title>
			<link>http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/wow-what-a-week-in</link>
			<pubDate>Wed, 30 Mar 2011 22:43:00 +0000</pubDate>			<dc:creator>SQLology ~ Kim Tessereau</dc:creator>
			<category domain="alt">Data Modelling &amp; Design</category>
<category domain="alt">Database Administration</category>
<category domain="main">Microsoft SQL Server Admin</category>
<category domain="alt">Microsoft SQL Server</category>
<category domain="alt">SSIS</category>
<category domain="alt">SSRS</category>			<guid isPermaLink="false">1172@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;Well this is my first blog posting and I have plenty to blog about.&amp;#160; Last week was amazing!&amp;#160; It all started on....&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Tuesday:&lt;/strong&gt; My day started at Microsoft in St. Louis.&amp;#160; I got there nerdy early, as usual.&amp;#160; Microsoft is located on the 11th floor so I rode the elevator up and the doors opened up and there stood two guys and a bunch of bagels!&amp;#160; It was&amp;#160;Jose and Austin from PragmaticWorks.&amp;#160; They were waiting for Brian Knight to open up the doors to the office so they could setup for the day.&amp;#160; Today was the first day of an SSAS Workshop and I was eager to get started.&amp;#160; People started filing in right away.&amp;#160; It was good to hook up with lots of folks from our SQL Server User Group in St. Louis, Julie Bloomquist, Pete Williams, John Dempsey, Rosa Johnson and Phil Milner.&amp;#160; And then a semi-familiar face came through the door, it was Bill Fellows from KC!&amp;#160; This was shaping up to be quite a social event as well as a technical one.&amp;#160;&amp;#160; Brian Knight started right on que at 8:30am.&amp;#160; He has incredible energy, like you can tell when he is in the house!&amp;#160; Class started out fast and furious and Brian took us from 0 to 60 in no time at all.&amp;#160; Before we knew it we were brousing our first cube.&amp;#160; By the end of the day everyone&#039;s head was spinning with thoughts of what they could implement back at the ranch.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Wednesday: &lt;/strong&gt;Back to Microsoft and I was early again (a little habit I&#039;ve got).&amp;#160; Brian stopped by and chatted with me for a while and asked if I would help him with his first demo of the day.&amp;#160; Well, of couse, I was excited!&amp;#160; He likes to make things fun so he made up this website called Swank Dating Site.&amp;#160; I work for Swank Motion Pictures and everyone is always asking if it&#039;s legit!&amp;#160; We had a lot of fun with it and the class was in a roar most of the morning.&amp;#160; I learned a ton and refined most of my BI skillset, which reined from SQL Server 2005.&amp;#160; After class was over myself and John Dempsey invited Brian and his crew out for dinner and a drink at the local pub.&amp;#160; It was great spending time with these guys, they were so full of energy and so much fun!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Thursday: &lt;/strong&gt;And we&#039;re back at Microsoft for another round with Brian and company!&amp;#160; This time it was an executive BI roundtable event.&amp;#160; And the event was being moderated by Jin Cho, Microsoft&amp;#8217;s Business Intelligence Technology Solutions Professional.&amp;#160; He was great, giving us good information about how to solve business problems with BI.&amp;#160; Brian also kick in a demo on some of the front-end tools that are part of the Microsoft BI stack.&amp;#160; Lots of great conversation surrounded this event.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Friday: &lt;/strong&gt;Back at Swank for the morning and then off at noon to pick up my SQL Saturday buddies!&amp;#160; John Dempsey, Sanil Mhatre and Danielle Beniot.&amp;#160; We were off to Chicago for the next couple of days!&amp;#160; We made great time getting up to Chicago and pulled into town about 5:30pm.&amp;#160; Danielle scouted out a great place for sushi, called Orchid, I thought it was a great name for a primary key!&amp;#160; After dinner it was back to the hotel for a few drinks.&amp;#160; Wendy Pastrick tweeted that she and others were at the pool so off we went to meet up with them.&amp;#160; It&amp;#160;turned out to be&amp;#160;kind of an unscheduled pre-party for #sqlsat67.&amp;#160; &amp;#160;I had a&amp;#160;great time seeing a few people I had met before, Wendy, Michelle Ufford and Tom LaRock.&amp;#160; And I got to meet Christina Leo and Jes Borland for the first time.&amp;#160; Well time slipped away from me and before I knew it, it was time to hit the hay.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Saturday:&lt;/strong&gt; Up early and heading over to DeVry University for a great day with friends!&amp;#160; We were all very excited to be sitting in on some excellent sessions given by excellent presenter&#039;s.&amp;#160; The day went by so fast I could hardly believe it.&amp;#160; Before I knew it was lunch time and I was up to speak at the WIT Lunch panel.&amp;#160; I love being involved with the virtual chapter of Women In Technology group.&amp;#160; The topic for the day was &quot;Energizing the Next Generation&quot;.&amp;#160; Jes did a great job of moderating and Wendy, Hope Foley and Miyaka Tabe were all so good!&amp;#160; And then, as fast as the morning had went so did the afternoon and there we stood as everyone cheered to close out the second, very successful SQL Saturday Chicago!&amp;#160; I was so proud to be a part of it! &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sunday: &lt;/strong&gt;I think I had a SQL Server hangover after all of that!&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/wow-what-a-week-in&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>Well this is my first blog posting and I have plenty to blog about.&#160; Last week was amazing!&#160; It all started on....</p>
<p><strong>Tuesday:</strong> My day started at Microsoft in St. Louis.&#160; I got there nerdy early, as usual.&#160; Microsoft is located on the 11th floor so I rode the elevator up and the doors opened up and there stood two guys and a bunch of bagels!&#160; It was&#160;Jose and Austin from PragmaticWorks.&#160; They were waiting for Brian Knight to open up the doors to the office so they could setup for the day.&#160; Today was the first day of an SSAS Workshop and I was eager to get started.&#160; People started filing in right away.&#160; It was good to hook up with lots of folks from our SQL Server User Group in St. Louis, Julie Bloomquist, Pete Williams, John Dempsey, Rosa Johnson and Phil Milner.&#160; And then a semi-familiar face came through the door, it was Bill Fellows from KC!&#160; This was shaping up to be quite a social event as well as a technical one.&#160;&#160; Brian Knight started right on que at 8:30am.&#160; He has incredible energy, like you can tell when he is in the house!&#160; Class started out fast and furious and Brian took us from 0 to 60 in no time at all.&#160; Before we knew it we were brousing our first cube.&#160; By the end of the day everyone's head was spinning with thoughts of what they could implement back at the ranch.</p>
<p><strong>Wednesday: </strong>Back to Microsoft and I was early again (a little habit I've got).&#160; Brian stopped by and chatted with me for a while and asked if I would help him with his first demo of the day.&#160; Well, of couse, I was excited!&#160; He likes to make things fun so he made up this website called Swank Dating Site.&#160; I work for Swank Motion Pictures and everyone is always asking if it's legit!&#160; We had a lot of fun with it and the class was in a roar most of the morning.&#160; I learned a ton and refined most of my BI skillset, which reined from SQL Server 2005.&#160; After class was over myself and John Dempsey invited Brian and his crew out for dinner and a drink at the local pub.&#160; It was great spending time with these guys, they were so full of energy and so much fun!</p>
<p><strong>Thursday: </strong>And we're back at Microsoft for another round with Brian and company!&#160; This time it was an executive BI roundtable event.&#160; And the event was being moderated by Jin Cho, Microsoft&#8217;s Business Intelligence Technology Solutions Professional.&#160; He was great, giving us good information about how to solve business problems with BI.&#160; Brian also kick in a demo on some of the front-end tools that are part of the Microsoft BI stack.&#160; Lots of great conversation surrounded this event.</p>
<p><strong>Friday: </strong>Back at Swank for the morning and then off at noon to pick up my SQL Saturday buddies!&#160; John Dempsey, Sanil Mhatre and Danielle Beniot.&#160; We were off to Chicago for the next couple of days!&#160; We made great time getting up to Chicago and pulled into town about 5:30pm.&#160; Danielle scouted out a great place for sushi, called Orchid, I thought it was a great name for a primary key!&#160; After dinner it was back to the hotel for a few drinks.&#160; Wendy Pastrick tweeted that she and others were at the pool so off we went to meet up with them.&#160; It&#160;turned out to be&#160;kind of an unscheduled pre-party for #sqlsat67.&#160; &#160;I had a&#160;great time seeing a few people I had met before, Wendy, Michelle Ufford and Tom LaRock.&#160; And I got to meet Christina Leo and Jes Borland for the first time.&#160; Well time slipped away from me and before I knew it, it was time to hit the hay.</p>
<p><strong>Saturday:</strong> Up early and heading over to DeVry University for a great day with friends!&#160; We were all very excited to be sitting in on some excellent sessions given by excellent presenter's.&#160; The day went by so fast I could hardly believe it.&#160; Before I knew it was lunch time and I was up to speak at the WIT Lunch panel.&#160; I love being involved with the virtual chapter of Women In Technology group.&#160; The topic for the day was "Energizing the Next Generation".&#160; Jes did a great job of moderating and Wendy, Hope Foley and Miyaka Tabe were all so good!&#160; And then, as fast as the morning had went so did the afternoon and there we stood as everyone cheered to close out the second, very successful SQL Saturday Chicago!&#160; I was so proud to be a part of it! </p>
<p><strong>Sunday: </strong>I think I had a SQL Server hangover after all of that!</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/wow-what-a-week-in">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/DataMgmt/DBAdmin/MSSQLServerAdmin/wow-what-a-week-in#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/DataMgmt/?tempskin=_rss2&#38;disp=comments&#38;p=1172</wfw:commentRss>
		</item>
			</channel>
</rss>
