<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Notes from SQL Server Premier Field Engineer</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/sqlpfe/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/sqlpfe/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:27:11 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>New training from Microsoft</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/new-training-from-microsoft</link>
      <pubDate>Sat, 08 Jan 2011 18:53:15 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2011/01/08/new-training-from-microsoft/</guid>
      <description><![CDATA[Microsoft made&nbsp;SQL Server 2008 Microsoft Certified Master (MCM) Readiness Videos available on...]]></description>
      <content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 0in 0pt;">Microsoft made&nbsp;SQL Server 2008 Microsoft Certified Master (MCM) Readiness Videos available on their site. <a href="http://technet.microsoft.com/en-us/sqlserver/ff977043.aspx" title="Here">Here</a> they are </p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;">&nbsp;</p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;">Enjoy!</p>]]></content:encoded>
    </item>
    <item>
      <title>Creating useful statistics from _WA_Sys stats</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/creating-useful-statistics-from-_wa_sys-stats</link>
      <pubDate>Thu, 17 Jun 2010 17:01:00 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2010/06/17/creating-useful-statistics-from-_wa_sys-stats/</guid>
      <description><![CDATA[&nbsp;
&nbsp;
You probably well aware that keeping statistics up-to-date is essential for SQL...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p>&nbsp;</p>
<p>You probably well aware that keeping statistics up-to-date is essential for SQL Server performance. You may also well know that if statistics is missing &nbsp;on the columns of the table SQL Server creates _WA_Sys* stats for you automatically to have something instead of nothing to help optimizer decide which plan to chose. You shall not be relying on this in practice and always strive to keep your stats in a good shape. Script below will help you to convert numerous _WA_Sys* stats on your server into more meaningfully named single column stats.&nbsp;</p>
<p>&nbsp;</p>
<p>SELECT</p>
<p>&nbsp;</p>
<p>N'</p>
<p>DROP STATISTICS [' + schema_name(t.schema_id)+N'].['+ t.name + N'].[' + s.name + N']</p>
<p>GO</p>
<p>&nbsp;</p>
<p>CREATE STATISTICS [' + c.name + N'] ON [' + schema_name(t.schema_id)+N'].['+t.name + N'] ([' + c.name + N']) WITH FULLSCAN</p>
<p>GO</p>
<p>&nbsp;</p>
<p>'</p>
<p>FROM sys.stats s (NOLOCK)</p>
<p>INNER JOIN sys.stats_columns (NOLOCK)sic ON sic.stats_id=s.stats_id AND sic.object_id=s.object_id</p>
<p>INNER JOIN sys.tables t (NOLOCK) on t.object_id = s.object_id</p>
<p>INNER JOIN sys.columns c (NOLOCK) on c.column_id = sic.column_id and c.object_id = sic.object_id</p>
<p>WHERE s.name like '%_WA_Sys%'</p>
<p>ORDER BY t.name</p>
<p>&nbsp;</p>
<p>GO</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Moving large tables between environments</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/moving-large-tables-between-environments</link>
      <pubDate>Wed, 02 Jun 2010 08:55:37 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2010/06/02/moving-large-tables-between-environments/</guid>
      <description><![CDATA[Hello readers!
Couple of days ago I had to move large table (~43 mln rows) from production...]]></description>
      <content:encoded><![CDATA[<p>Hello readers!</p>
<p>Couple of days ago I had to move large table (~43 mln rows) from production environment to a dev environment.</p>
<p>
<p>
<p>Below is a table structure as follows:</p>
<p>CREATE TABLE [mmm].[Music Band](</p>
<p>[BandID] [int] IDENTITY(1,1) NOT NULL,</p>
<p>[BandTypeID] [tinyint] NOT NULL,</p>
<p>[BandName] [nvarchar](255) NOT NULL,</p>
<p>[IsAvailable] [bit] NOT NULL,</p>
<p>[IsRemoved] [tinyint] NOT NULL,</p>
<p>[CreatedDataSourceTypeID] [smallint] NOT NULL,</p>
<p>[CreatedDataSourceID] [int] NOT NULL,</p>
<p>[UpdatedDataSourceTypeID] [smallint] NOT NULL,</p>
<p>[UpdatedDataSourceID] [int] NOT NULL,</p>
<p>[DateCreated] [datetime] NOT NULL DEFAULT (getdate()),</p>
<p>[DateModified] [datetime] NOT NULL DEFAULT (getdate()),</p>
<p>[LastUpdated] [timestamp] NOT NULL</p>
<p>)</p>
</p>
<p>My initial approach was to use SSIS package to export data to a text file, then ship text file via ftp to a different server and then load text file via SSIS package to a table on a new server.</p>
<p>This approach failed miserably as it took very long time to debug package failures due to load issues from text file. Firstly,&nbsp;[BandName] can have different text data in it, including special characters like ],[,| %, $ etc since it represents name of the music band.&nbsp;So, no matter which delimiters you use in text file since there 43 mln rows in original table, likelihood of failure is very high. There are other possible reasons for failures, but I will omit them here.</p>
<p>So, what I did instead was to create a separate database, move table definition and all its data to this new database via SSIS (simple package with OLEDB Source and destination in data flow task), backup database, then ftp backup to the destination server, restore database backup on it and then move data to destination database again via&nbsp;SSIS (simple package with OLEDB Source and destination in data flow task), drop intermediate database and voila, done.</p>
<p>&nbsp;</p>
<p>I hope you find this simple trick useful.</p>
<p>Cheers,</p>
<p>-Yuriy</p>
<p>&nbsp;</p>
</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server system information</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/sql-server-system-information</link>
      <pubDate>Sat, 30 Jan 2010 11:13:00 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2010/01/30/sql-server-system-information/</guid>
      <description><![CDATA[I guess many of you are familiar with build in SQL server function @@version, which you can use to...]]></description>
      <content:encoded><![CDATA[<p>I guess many of you are familiar with build in SQL server function @@version, which you can use to quickly tell what SKU of SQL Server and Windows OS you are using as well as build numbers. Perhaps you are also aware of &nbsp;serverproperty(param) function which tells you similar things eg your SQL Server instance name, if it is clustered or not etc.</p><p>Simple query below uses serverproperty function to tell you system level info about SQL Server.</p><p>I build it just recently for a small pet project of mine and decided to post it here just in case someone finds it useful too :) &nbsp;</p><p>select&nbsp;</p><p>serverproperty('ProductVersion') as [SQL server build number],</p><p>serverproperty('Edition') as [SQL server SKU],</p><p>serverproperty('ProductLevel') as [SQL server service pack level],</p><p>serverproperty('IsClustered') as [Is SQL server clustered],</p><p>serverproperty('MachineName') as [Windows server name],</p><p>serverproperty('ServerName') as [Full SQL server instance name],</p><p>serverproperty('InstanceName') as [SQL server instance name],</p><p>serverproperty('ProcessID') as [SQL server Windows process ID],</p><p>serverproperty('Collation') as [SQL server instance collation]&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Embeding XML into XML using FOR XML option</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/embeding-xml-into-xml-using-for-xml-option</link>
      <pubDate>Fri, 29 Jan 2010 14:23:00 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2010/01/29/embeding-xml-into-xml-using-for-xml-option/</guid>
      <description><![CDATA[Hello, everyone!Today I am going to chat briefly about the question a co-worker asked me about.The...]]></description>
      <content:encoded><![CDATA[<p>Hello, everyone!</p><p>Today I am going to chat briefly about the question a co-worker asked me about.</p><p>The problem was with embedding one XML snippet generated by using FOR XML option of the query into another XML also generated using FOR XML option.</p><p>Here is cleaned up version of the query :</p><p>declare @t table(c1 int, c2 int, ts binary(8))</p><p><br></p><p>insert into @t(c1,c2)</p><p>select 1, 2&nbsp;</p><p>union all</p><p>select 3, 4&nbsp;</p><p>union all</p><p>select 5, 6</p><p><br></p><p>declare @message xml</p><p><br></p><p>select @message =</p><p><br></p><p><span class="Apple-tab-span" style="white-space:pre">	</span> ( &nbsp;select &nbsp; &nbsp; &nbsp;</p><p><span class="Apple-tab-span" style="white-space:pre">		</span>123 as '@attribute1',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;345 as '@attribute2',</p><p><span class="Apple-tab-span" style="white-space:pre">		</span>456 as '@timestamp',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;getdate() as '@currentDate',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (select c1 as '@c1',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c2 as '@c2'</p><p><span class="Apple-tab-span" style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from @t</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for xml path('item')</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;) as 'items'</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for xml path ('items_list'), binary base64</p><p>&nbsp;&nbsp; &nbsp; &nbsp;)</p><p>select @message&nbsp;</p><p>If you execute this query directly against your instance of SQL Server you will get the following result:</p><p>&lt;items_list attribute1="123" attribute2="345" timestamp="456" currentDate="2010-01-29T19:43:36.117"&gt;</p><p>&nbsp;&nbsp;&lt;items&gt;&amp;lt;item c1="1" c2="2"/&amp;gt;&amp;lt;item c1="3" c2="4"/&amp;gt;&amp;lt;item c1="5" c2="6"/&amp;gt;&lt;/items&gt;</p><p>&lt;/items_list&gt;&nbsp;</p><p>&nbsp;</p><p>Please notice&nbsp;&amp;lt; and&nbsp;&amp;gt; in the output, since '&lt;' and '&gt;' have specific meaning in XML as tags. This is surely not what my coworker expected and intended.</p><p>The reason for this is that&nbsp;the result of the inner FOR XML&nbsp;query is returned as nvarchar(max) by default. The straightforward way around it is to cast the result to xml type using CAST as follows:</p><p><b><span class="Apple-style-span" style="font-weight: normal; ">&nbsp;&nbsp;</span></b></p><p>declare @t table(c1 int, c2 int, ts binary(8))</p><p><br></p><p>insert into @t(c1,c2)</p><p>select 1, 2&nbsp;</p><p>union all</p><p>select 3, 4&nbsp;</p><p>union all</p><p>select 5, 6</p><p><br></p><p>declare @message xml</p><p>select @message =</p><p><span class="Apple-tab-span" style="white-space:pre">	</span> ( &nbsp;select &nbsp; &nbsp; &nbsp;</p><p><span class="Apple-tab-span" style="white-space:pre">		</span>123 as '@attribute1',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;345 as '@attribute2',</p><p><span class="Apple-tab-span" style="white-space:pre">		</span>&nbsp;456 as '@timestamp',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;getdate() as '@currentDate',</p><p>&nbsp;</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cast (</p><p><span class="Apple-tab-span" style="white-space:pre">				</span>(select c1 as '@c1',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c2 as '@c2'</p><p><span class="Apple-tab-span" style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from @t</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre">	</span>for xml path('item')&nbsp;</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;) </p><p><span class="Apple-tab-span" style="white-space:pre">			</span>as xml )&nbsp;as 'items' &nbsp; &nbsp; &nbsp;</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for xml path ('items_list'), binary base64</p><p>&nbsp;&nbsp; &nbsp; &nbsp;)</p><p>select @message&nbsp;</p><p>&nbsp;</p><p>The output of this is what was intended:</p><p>&nbsp;</p><p>&lt;items_list attribute1="123" attribute2="345" timestamp="456" currentDate="2010-01-29T19:51:06.940"&gt;</p><p>&nbsp;&nbsp;&lt;items&gt;</p><p>&nbsp;&nbsp; &nbsp;&lt;item c1="1" c2="2" /&gt;</p><p>&nbsp;&nbsp; &nbsp;&lt;item c1="3" c2="4" /&gt;</p><p>&nbsp;&nbsp; &nbsp;&lt;item c1="5" c2="6" /&gt;</p><p>&nbsp;&nbsp;&lt;/items&gt;</p><p>&lt;/items_list&gt;</p><p>&nbsp;</p><p>&nbsp;However, in SQL Server FOR XML clause allows for&nbsp;TYPE option to achieve exactly this so there is no need to cast the result to XML type:</p><p>&nbsp;declare @t table(c1 int, c2 int, ts binary(8))</p><p><br></p><p>insert into @t(c1,c2)</p><p>select 1, 2&nbsp;</p><p>union all</p><p>select 3, 4&nbsp;</p><p>union all</p><p>select 5, 6</p><p><br></p><p>declare @message xml</p><p><br></p><p>select @message =</p><p><br></p><p><span class="Apple-tab-span" style="white-space:pre">	</span> ( &nbsp;select &nbsp; &nbsp; &nbsp;</p><p><span class="Apple-tab-span" style="white-space:pre">				</span>123 as '@attribute1',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;345 as '@attribute2',</p><p><span class="Apple-tab-span" style="white-space:pre">			</span> &nbsp; &nbsp;456 as '@timestamp',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;getdate() as '@currentDate',</p><p><br></p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (select c1 as '@c1',</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c2 as '@c2'</p><p><span class="Apple-tab-span" style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; from @t</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for xml path('item'), TYPE&nbsp;</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;) as 'items'</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p><p>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for xml path ('items_list'), binary base64</p><p>&nbsp;&nbsp; &nbsp; &nbsp;)</p><p>select @message</p><p>with much desired output:</p><p>&nbsp;&lt;items_list attribute1="123" attribute2="345" timestamp="456" currentDate="2010-01-29T19:55:37.973"&gt;</p><p>&nbsp;&nbsp;&lt;items&gt;</p><p>&nbsp;&nbsp; &nbsp;&lt;item c1="1" c2="2" /&gt;</p><p>&nbsp;&nbsp; &nbsp;&lt;item c1="3" c2="4" /&gt;</p><p>&nbsp;&nbsp; &nbsp;&lt;item c1="5" c2="6" /&gt;</p><p>&nbsp;&nbsp;&lt;/items&gt;</p><p>&lt;/items_list&gt;</p><p>&nbsp;</p><p>Hope description of this small 'gotcha' was useful.</p><p>Until next time.</p><p>-Yuriy &nbsp;</p><p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Maximum sizes and numbers for SQL Server</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/maximum-sizes-and-numbers-for-sql-server</link>
      <pubDate>Sun, 10 Jan 2010 14:51:00 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2010/01/10/maximum-sizes-and-numbers-for-sql-server/</guid>
      <description><![CDATA[While working with SQL Server you've probably heard certain restrictions like 'There can be at most...]]></description>
      <content:encoded><![CDATA[<p>While working with SQL Server you've probably heard certain restrictions like 'There can be at most 1,024&nbsp;columns declared in the table' or 'There can be only 8,600 bytes per row'. Some are urban legends and travel by the word of mouth others are hard to keep in the head even for people who constantly work with SQL Server. In case you wondered what these limits are, Microsoft has a complete list of them&nbsp;<a class="" mce_href="http://technet.microsoft.com/en-us/library/ms143432.aspx" href="http://technet.microsoft.com/en-us/library/ms143432.aspx">here</a>&nbsp;. I personally think it is quite useful to be aware of these limits.</p><p><a mce_href="http://technet.microsoft.com/en-us/library/ms143432.aspx" href="http://technet.microsoft.com/en-us/library/ms143432.aspx"></a>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>SQL Server 2005/2008 database tuning - picking low hanging fruits - part 2</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/sql-server-20052008-database-tuning-picking-low-hanging-fruits-part-2</link>
      <pubDate>Thu, 07 Jan 2010 03:44:00 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2010/01/07/sql-server-20052008-database-tuning-picking-low-hanging-fruits-part-2/</guid>
      <description><![CDATA[Some time ago I wrote a post how&nbsp;SQL Server optimizer keep&nbsp;track of what indexes maybe...]]></description>
      <content:encoded><![CDATA[<p>Some time <a class="" mce_href="http://blogs.msdn.com/sqlpfe/archive/2009/03/31/sql-server-2005-2008-database-tuning-picking-low-hanging-fruits.aspx" href="http://blogs.msdn.com/sqlpfe/archive/2009/03/31/sql-server-2005-2008-database-tuning-picking-low-hanging-fruits.aspx"><b><font color="#006bad">ago</font></b></a> I wrote a post how&nbsp;SQL Server optimizer keep&nbsp;track of what indexes maybe beneficial and logs&nbsp;this info into sys.dm_db_missing_index_* DMVs. Brent Ozar kindly <a class="" mce_href="http://sqlserverpedia.com/wiki/Find_Missing_Indexes" href="http://sqlserverpedia.com/wiki/Find_Missing_Indexes"><b><font color="#006bad">pointed out</font></b></a> that one can script 'CREATE INDEX' statement to build missing indexes to achieve performance gains. However, what&nbsp;was&nbsp;missing in my past post is what SQL statement may benefit from such an index. Fortunately, SQL Server puts missing index information in query execution plan, which is just a typed XML, whose XSD schema file can be found in &lt;disk&gt;<span class="Apple-style-span" style="WORD-SPACING: 0px; FONT: medium 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="FONT-SIZE: 13px; LINE-HEIGHT: 17px; FONT-FAMILY: Helvetica, Arial, sans-serif; TEXT-ALIGN: left">:\Program Files\Microsoft SQL Server\100\Tools\Binn\schemas\sqlserver\2004\07\showplan folder of your SQL Server 2008 installation. One place to lookup for query execution plans in XML format for SQL statement is a plan cache of SQL Server using </span></span></p><span class="Apple-style-span" style="WORD-SPACING: 0px; FONT: medium 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="FONT-SIZE: 13px; LINE-HEIGHT: 17px; FONT-FAMILY: Helvetica, Arial, sans-serif; TEXT-ALIGN: left"><font color="#008000" size="2"><font color="#008000" size="2"><p><span class="Apple-style-span" style="WORD-SPACING: 0px; FONT: medium 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="FONT-SIZE: 13px; LINE-HEIGHT: 17px; FONT-FAMILY: Helvetica, Arial, sans-serif; TEXT-ALIGN: left"><font color="#000000" size="2">sys.dm_exec_query_stats DMV and sys.dm_exec_sql_text and sys.dm_exec_query_plan DMFs as follows</font></span></span></p></font></font></span></span><p><span class="Apple-style-span" style="WORD-SPACING: 0px; FONT: medium 'Times New Roman'; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-style-span" style="FONT-SIZE: 13px; LINE-HEIGHT: 17px; FONT-FAMILY: Helvetica, Arial, sans-serif; TEXT-ALIGN: left"><font color="#0000ff" size="2"><font color="#0000ff" size="2">select</font></font><font size="2"> qp</font><font color="#808080" size="2"><font color="#808080" size="2">.</font></font><font size="2">query_plan</font><font color="#808080" size="2"><font color="#808080" size="2">,</font></font></span></span></p><font color="#808080" size="2"><font color="#808080" size="2"></font></font><font color="#ff00ff" size="2"><font color="#ff00ff" size="2"></font></font><p><font color="#ff00ff" size="2"><font color="#ff00ff" size="2">SUBSTRING</font></font><font color="#808080" size="2"><font color="#808080" size="2">(</font></font><font size="2">st</font><font color="#808080" size="2"><font color="#808080" size="2">.</font></font><font size="2">TEXT</font><font color="#808080" size="2"><font color="#808080" size="2">,</font></font><font size="2"> </font><font color="#808080" size="2"><font color="#808080" size="2">(</font></font><font size="2">qs</font><font color="#808080" size="2"><font color="#808080" size="2">.</font></font><font size="2">statement_start_offset</font><font color="#808080" size="2"><font color="#808080" size="2">/</font></font><font size="2">2</font><font color="#808080" size="2"><font color="#808080" size="2">)+</font></font><font size="2">1 </font><font color="#808080" size="2"><font color="#808080" size="2">,</font></font><font size="2"> </font></p><font size="2"></font><p><font color="#808080" size="2"><font color="#808080" size="2">((</font></font><font size="2"> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">CASE</font></font><font size="2"> qs</font><font color="#808080" size="2"><font color="#808080" size="2">.</font></font><font size="2">statement_end_offset </font></p><font size="2"></font><p><font color="#0000ff" size="2"><font color="#0000ff" size="2">WHEN</font></font><font size="2"> </font><font color="#808080" size="2"><font color="#808080" size="2">-</font></font><font size="2">1 </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">THEN</font></font><font size="2"> </font><font color="#ff00ff" size="2"><font color="#ff00ff" size="2">datalength</font></font><font color="#808080" size="2"><font color="#808080" size="2">(</font></font><font size="2">st</font><font color="#808080" size="2"><font color="#808080" size="2">.</font></font><font size="2">TEXT</font><font color="#808080" size="2"><font color="#808080" size="2">)</font></font><font size="2"> </font></p><font size="2"></font><p><font color="#0000ff" size="2"><font color="#0000ff" size="2">ELSE</font></font><font size="2"> qs</font><font color="#808080" size="2"><font color="#808080" size="2">.</font></font><font size="2">statement_end_offset </font></p><font size="2"></font><p><font color="#0000ff" size="2"><font color="#0000ff" size="2">END</font></font><font size="2"> </font></p><font size="2"></font><p><font color="#808080" size="2"><font color="#808080" size="2">-</font></font><font size="2"> qs</font><font color="#808080" size="2"><font color="#808080" size="2">.</font></font><font size="2">statement_start_offset</font><font color="#808080" size="2"><font color="#808080" size="2">)/</font></font><font size="2">2</font><font color="#808080" size="2"><font color="#808080" size="2">)</font></font><font size="2"> </font><font color="#808080" size="2"><font color="#808080" size="2">+</font></font><font size="2"> 1</font><font color="#808080" size="2"><font color="#808080" size="2">)</font></font><font size="2"> </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">AS</font></font><font size="2"> txt</font></p><font size="2"></font><font color="#0000ff" size="2"><font color="#0000ff" size="2"></font></font><p><font color="#0000ff" size="2"><font color="#0000ff" size="2">from</font></font><font size="2"> </font><font color="#008000" size="2"><font color="#008000" size="2">sys.dm_exec_query_stats</font></font><font size="2"> qs</font></p><font size="2"></font><font color="#808080" size="2"><font color="#808080" size="2"></font></font><p><font color="#808080" size="2"><font color="#808080" size="2">cross</font></font><font size="2"> </font><font color="#808080" size="2"><font color="#808080" size="2">apply</font></font><font size="2"> sys.dm_exec_sql_text</font><font color="#808080" size="2"><font color="#808080" size="2">(</font></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">sql_handle</font></font><font color="#808080" size="2"><font color="#808080" size="2">)</font></font><font size="2"> st</font></p><font size="2"></font><font color="#808080" size="2"><font color="#808080" size="2"></font></font><p><font color="#808080" size="2"><font color="#808080" size="2">cross</font></font><font size="2"> </font><font color="#808080" size="2"><font color="#808080" size="2">apply</font></font><font size="2"> sys.dm_exec_query_plan</font><font color="#808080" size="2"><font color="#808080" size="2">(</font></font><font size="2">plan_handle</font><font color="#808080" size="2"><font color="#808080" size="2">)</font></font><font size="2"> qp</font></p><font size="2"></font><p mce_keep="true">Then one can modify above statment with XQuery&nbsp;to query for Missing Index information using above mentioned&nbsp;XSD schema for XML&nbsp;showplan in SQL Server 2008 to get what potential index is missing for the statement. Please note&nbsp;that not all statement have&nbsp;index missing, only some. &nbsp;&nbsp;</p><p mce_keep="true">Luckily, Brent Ozar and great site&nbsp;<a href="http://www.sqlserverpedia.com/"><b><font color="#006bad">www.sqlserverpedia.com</font></b></a> already have <a class="" mce_href="http://sqlserverpedia.com/wiki/Find_Queries_in_the_Plan_Cache_That_Are_Missing_an_Index" href="http://sqlserverpedia.com/wiki/Find_Queries_in_the_Plan_Cache_That_Are_Missing_an_Index"><b><font color="#006bad">full query</font></b></a> ready for this which I copied down below for your convenience.</p><p mce_keep="true">SELECT qp.query_plan<br>, total_worker_time/execution_count AS AvgCPU <br>, total_elapsed_time/execution_count AS AvgDuration <br>, (total_logical_reads+total_physical_reads)/execution_count AS AvgReads <br>, execution_count <br>, SUBSTRING(st.TEXT, (qs.statement_start_offset/2)+1 , ((CASE qs.statement_end_offset WHEN -1 THEN datalength(st.TEXT) ELSE qs.statement_end_offset END - qs.statement_start_offset)/2) + 1) AS txt <br>, qp.query_plan.value('declare default element namespace "<a href="http://schemas.microsoft.com/sqlserver/2004/07/showplan"><b><font color="#006bad">http://schemas.microsoft.com/sqlserver/2004/07/showplan</font></b></a>"; (<a><b>/ShowPlanXML/BatchSequence/Batch/Statements/StmtSimple/QueryPlan/MissingIndexes/MissingIndexGroup/@Impact)[1]'</b></a> , 'decimal(18,4)') * execution_count AS TotalImpact<br>, qp.query_plan.value('declare default element namespace "<a href="http://schemas.microsoft.com/sqlserver/2004/07/showplan"><b><font color="#006bad">http://schemas.microsoft.com/sqlserver/2004/07/showplan</font></b></a>"; (<a><b>/ShowPlanXML/BatchSequence/Batch/Statements/StmtSimple/QueryPlan/MissingIndexes/MissingIndexGroup/MissingIndex/@Database)[1]'</b></a> , 'varchar(100)') AS [DATABASE]<br>, qp.query_plan.value('declare default element namespace "<a href="http://schemas.microsoft.com/sqlserver/2004/07/showplan"><b><font color="#006bad">http://schemas.microsoft.com/sqlserver/2004/07/showplan</font></b></a>"; (<a><b>/ShowPlanXML/BatchSequence/Batch/Statements/StmtSimple/QueryPlan/MissingIndexes/MissingIndexGroup/MissingIndex/@Table)[1]'</b></a> , 'varchar(100)') AS [TABLE]<br>FROM sys.dm_exec_query_stats qs<br>cross apply sys.dm_exec_sql_text(sql_handle) st<br>cross apply sys.dm_exec_query_plan(plan_handle) qp<br>WHERE qp.query_plan.exist('declare default element namespace "<a href="http://schemas.microsoft.com/sqlserver/2004/07/showplan%22;/ShowPlanXML/BatchSequence/Batch/Statements/StmtSimple/QueryPlan/MissingIndexes/MissingIndexGroup/MissingIndex[@Database!=%22m%22]'"><b><font color="#006bad">http://schemas.microsoft.com/sqlserver/2004/07/showplan";/ShowPlanXML/BatchSequence/Batch/Statements/StmtSimple/QueryPlan/MissingIndexes/MissingIndexGroup/MissingIndex[@Database!="m"]'</font></b></a>) = 1<br>ORDER BY TotalImpact DESC<br></p><p mce_keep="true">So, now you know what indexes are missing and also have an idea what SQL statements benefit from that index.</p><p mce_keep="true">Happy querying!</p><p mce_keep="true">&nbsp;-Yuriy&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>TSQL coding patterns I</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/tsql-coding-patterns-i</link>
      <pubDate>Tue, 05 Jan 2010 19:35:00 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2010/01/05/tsql-coding-patterns-i/</guid>
      <description><![CDATA[With this post I will start writing some small TSQL coding patterns and tricks which make daily life...]]></description>
      <content:encoded><![CDATA[<p>With this post I will start writing some small TSQL coding patterns and tricks which make daily life of SQL Server database developer easier and are used a LOT when dealing with large databases.</p><span class="Apple-style-span" style="font-size: 11px; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">Data developers frequently have to update rows in tables. If table is small, you might be able to update the entire table using straightforward UPDATE statement like</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">&nbsp;<span class="Apple-style-span" style="color: rgb(0, 0, 0); font-size: 14px; line-height: normal; white-space: pre; ">UPDATE dbo.Foo </span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); "><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-size: 14px; line-height: normal; white-space: pre; "> SET Column = 'Value'</span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">However, for very large tables, say with 100,000+ rows this simply does not work because SQL Server will escalate row/page locks to a single table lock and your transaction will lock out users. The trick is to use<span class="Apple-style-span" style="color: rgb(0, 0, 0); font-size: 13px; line-height: normal; "><span class="Apple-style-span" style="font-size: 12px; color: rgb(74, 67, 61); line-height: 15px; ">&nbsp;TOP clause in the UPDATE statement together with OUTPUT clause to keep track of which rows have already been updated so that you don’t update them a second time:</span></span></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">DECLARE @UpdatedRows(PK_Id int NOT NULL PRIMARY KEY)</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">DECLARE @var INT</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">SELECT @var=0 -- this resets @@ROWCOUNT=1</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">&nbsp;</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">WHILE @@ROWCOUNT &gt;0</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">BEGIN</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); "><span class="Apple-tab-span" style="white-space:pre">	</span>UPDATE TOP(1500) BAR</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">&nbsp;<span class="Apple-tab-span" style="white-space:pre">	</span>SET Column='Value'</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); "><span class="Apple-tab-span" style="white-space:pre">	</span>OUTPUT inserted.PK_ID</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); "><span class="Apple-tab-span" style="white-space:pre">	</span>INTO&nbsp;&nbsp;@UpdatedRows</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); "><span class="Apple-tab-span" style="white-space:pre">	</span>FROM&nbsp;&nbsp;dbo.BAR as BAR</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); "><span class="Apple-tab-span" style="white-space:pre">	</span>WHERE NOT EXISTS (SELECT 1 FROM&nbsp;@UpdatedRows UPD WHERE UPD.PK_ID=BAR.PK_ID)</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">END&nbsp;</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">Please note that result of the output clause may be a permanent work table if you expect large number of rows and thus expect to hit scalability limits of table variables.&nbsp;</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">Hope you find it useful.</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">Regards,</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">-Yuriy&nbsp;</p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.1em; line-height: 1.25; color: rgb(74, 67, 61); ">&nbsp;</p></span>]]></content:encoded>
    </item>
    <item>
      <title>Visited from</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/visited-from</link>
      <pubDate>Sun, 06 Dec 2009 14:16:00 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2009/12/06/visited-from/</guid>
      <description><![CDATA[&lt;a href="http://www4.clustrmaps.com/counter/maps.php?url=http://blogs.msdn.com/sqlpfe/"...]]></description>
      <content:encoded><![CDATA[<span class="Apple-style-span" style="font-family: monospace; white-space: pre-wrap; ">&lt;a href="http://www4.clustrmaps.com/counter/maps.php?url=http://blogs.msdn.com/sqlpfe/" id="clustrMapsLink"&gt;&lt;img src="http://www4.clustrmaps.com/counter/index2.php?url=http://blogs.msdn.com/sqlpfe/" style="border:0px;" alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg" onerror="this.onerror=null; this.src='http://www2.clustrmaps.com/images/clustrmaps-back-soon.jpg'; document.getElementById('clustrMapsLink').href='http://www2.clustrmaps.com';" /&gt;&lt;/a&gt;</span><div><font class="Apple-style-span" face="monospace"><span class="Apple-style-span" style="white-space: pre-wrap;"><br></span></font></div>]]></content:encoded>
    </item>
    <item>
      <title>Automatically refreshing your Excel reports</title>
      <link>https://docs.microsoft.com/archive/blogs/sqlpfe/automatically-refreshing-your-excel-reports</link>
      <pubDate>Fri, 23 Oct 2009 15:40:00 GMT</pubDate>
      <dc:creator><![CDATA[yuriyt]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/sqlpfe/2009/10/23/automatically-refreshing-your-excel-reports/</guid>
      <description><![CDATA[Many organization have lots of Excel reports and pivot tables whose data comes from SQL Server. As...]]></description>
      <content:encoded><![CDATA[<P>Many organization have lots of Excel reports and pivot tables whose data comes from SQL Server. As data on the backend database changes you would need to repopulate your excel books with updated information. Doing it by hand can be very tedious manual process for the reporting analyst and there are ways to automate it. The simplest way is to create a SQL Agent job which refreshes your books on a scheduled basis. VBScript below does exactly that. Just add a step&nbsp;to&nbsp;your refresh job for every report you want to refresh substituting "&lt;path to your excel file&gt;" with location of your excel file on some file share.</P>
<P>&nbsp;Set oWorkBook = oExcel.Workbooks.Open("&lt;path to your excel file&gt;")</P>
<P>Now you saved yourself a whole lot time and can start working on more interesting things!</P>
<P>Cheers, -Yuriy</P>
<P mce_keep="true">&nbsp;</P>
<P>Script below </P>
<P mce_keep="true">&nbsp;</P>
<P>Function Main()<BR>Dim oExcel<BR>Dim oWorkBook<BR>Dim oWorksheet<BR>Dim oPivotTable<BR>Dim IStartedExcel<BR>&nbsp;<BR>On Error Resume Next<BR>Set oExcel = GetObject("Excel.Application")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'will attach to an existing instance if it is there.<BR>oExcel.Quit<BR>&nbsp;<BR>'Instantiate excel object; disable alert messages<BR>Set&nbsp; oExcel = CreateObject("Excel.Application")<BR>oExcel.DisplayAlerts = false<BR>&nbsp;<BR>'when debugging set visible = true<BR>oExcel.visible = true</P>
<P>'open workbook we wish to refresh<BR>Set oWorkBook = oExcel.Workbooks.Open("&lt;path to your excel file&gt;")<BR>oWorkbook.EnableConnections <BR>oWorkbook.RefreshAll<BR>oExcel.CalculateUntilAsyncQueriesDone<BR>oWorkbook.Save<BR>oWorkBook.Close<BR>&nbsp;<BR>oExcel.Quit<BR>Set oExcel = Nothing<BR>&nbsp;<BR>'Main = DTSTaskExecResult_Success</P>
<P>End Function</P>
<P><BR>&nbsp;</P>]]></content:encoded>
    </item>
  </channel>
</rss>