﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by J. T. Shyman / Article Discussions / Article Discussions by Author  / Using XP_EXECRESULTSET To Obtain Database Size Information and More / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 22:59:35 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;I'm afraid that's because the way I sent the article to the editors.&lt;/P&gt;&lt;P&gt;Here's the code in text:&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DECLARE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @DBName &lt;SPAN style="COLOR: blue"&gt;SYSNAME&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DECLARE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @SQLCmd &lt;SPAN style="COLOR: blue"&gt;NVARCHAR&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;(&lt;/SPAN&gt;2000&lt;SPAN style="COLOR: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @DBNAME&lt;SPAN style="COLOR: gray"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;''&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;WHILE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @DBNAME &lt;SPAN style="COLOR: gray"&gt;IS&lt;/SPAN&gt; &lt;SPAN style="COLOR: gray"&gt;NOT&lt;/SPAN&gt; &lt;SPAN style="COLOR: gray"&gt;NULL&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;      &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;BEGIN&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SELECT&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @DBNAME&lt;SPAN style="COLOR: gray"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: fuchsia"&gt;MIN&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;(&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;name&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;)&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;FROM&lt;/SPAN&gt; MASTER&lt;SPAN style="COLOR: gray"&gt;..&lt;/SPAN&gt;SYSDATABASES &lt;SPAN style="COLOR: blue"&gt;WHERE&lt;/SPAN&gt; sid &lt;SPAN style="COLOR: gray"&gt;&amp;gt;&lt;/SPAN&gt; 1 &lt;SPAN style="COLOR: gray"&gt;AND&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;name&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;&amp;gt;&lt;/SPAN&gt;@DBNAME&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;            &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;SET&lt;/SPAN&gt; @SQLCmd&lt;SPAN style="COLOR: gray"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;'SELECT ''SELECT name AS [File],&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;filename as [File Name],&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;CAST(size/128.0 as DECIMAL(10,2)) AS [Size in MB], &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;CAST(FILEPROPERTY(name, ''''SpaceUsed'''')/128.0 as DECIMAL(10,2)) as [Space Used], &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;CAST(size/128.0-(FILEPROPERTY(name, ''''SpaceUsed'''')/128.0) AS DECIMAL(10,2)) AS [Available Space]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;FROM SYSFILES'''&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;            &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;--PRINT @SQLCmd&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;            &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;IF&lt;/SPAN&gt; @DBName &lt;SPAN style="COLOR: gray"&gt;IS&lt;/SPAN&gt; &lt;SPAN style="COLOR: gray"&gt;NULL&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;BREAK&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;            &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;EXEC&lt;/SPAN&gt; MASTER&lt;SPAN style="COLOR: gray"&gt;..&lt;/SPAN&gt;XP_EXECRESULTSET @SQLCmd&lt;SPAN style="COLOR: gray"&gt;,&lt;/SPAN&gt; @DBName&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;      &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;END&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DECLARE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @SQL &lt;SPAN style="COLOR: blue"&gt;NVARCHAR&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;(&lt;/SPAN&gt;4000&lt;SPAN style="COLOR: gray"&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DECLARE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @USER &lt;SPAN style="COLOR: blue"&gt;SYSNAME&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DECLARE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @DATABASE &lt;SPAN style="COLOR: blue"&gt;SYSNAME&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;DECLARE&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @PERMISSION &lt;SPAN style="COLOR: blue"&gt;SYSNAME&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @USER&lt;SPAN style="COLOR: gray"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;'BOB'&lt;/SPAN&gt; &lt;SPAN style="COLOR: green"&gt;–- Replace with name of user&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @DATABASE&lt;SPAN style="COLOR: gray"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;'MyDB'&lt;/SPAN&gt; &lt;SPAN style="COLOR: green"&gt;–- Replace with database name&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @PERMISSION&lt;SPAN style="COLOR: gray"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;'EXECUTE' &lt;/SPAN&gt;&lt;SPAN style="COLOR: green"&gt;-- Replace with rights. You can use a comma separated list here. For example 'SELECT,UPDATE' if you want to modify permissions on tables&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;SET&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; @SQL&lt;SPAN style="COLOR: gray"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;'SELECT ''GRANT '&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;+&lt;/SPAN&gt;@PERMISSION&lt;SPAN style="COLOR: gray"&gt;+&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;' ON ''+NAME+'' TO '&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;+&lt;/SPAN&gt;@USER&lt;SPAN style="COLOR: gray"&gt;+&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;' ''FROM '&lt;/SPAN&gt;&lt;SPAN style="COLOR: gray"&gt;+&lt;/SPAN&gt;@DATABASE&lt;SPAN style="COLOR: gray"&gt;+&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;'..SYSOBJECTS WHERE TYPE=''P''&lt;SPAN style="mso-spacerun: yes"&gt;  &lt;/SPAN&gt;AND NAME LIKE ''USP%'''&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;EXEC&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: maroon"&gt;SP_EXECUTESQL&lt;/SPAN&gt; @SQL&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;EXEC&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt; MASTER&lt;SPAN style="COLOR: gray"&gt;..&lt;/SPAN&gt;XP_EXECRESULTSET @SQL&lt;SPAN style="COLOR: gray"&gt;,&lt;/SPAN&gt; @DATABASE&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;P&gt; &lt;/P&gt;&lt;/P&gt;</description><pubDate>Tue, 22 Aug 2006 11:40:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>Great article and very helpful.however, I wanted to experiment with it... why is the SQL a image and not text on the page?   Can't copy and paste imaged SQL.</description><pubDate>Tue, 22 Aug 2006 10:07:00 GMT</pubDate><dc:creator>alex hatcher</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>Warning : when using this procedure the result set it executes is run on the one of the main processor threads of SQL Server, not your connection thread. If you perform a long running query it can bring SQL Server to a stand still. Do not use on production servers - or at least with care.It happened to me (luckily on a DEV server) and my colleagues were asking me why SQL Server had stopped responding to their queries. Because the main thread was handling mine!You have been warned :-)</description><pubDate>Tue, 04 Jul 2006 10:54:00 GMT</pubDate><dc:creator>alexweatherall</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;Got it ...&lt;/P&gt;&lt;P&gt;Thanks &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;&lt;/P&gt;</description><pubDate>Wed, 28 Jun 2006 19:48:00 GMT</pubDate><dc:creator>HelloFOFO</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>Yeah, I noticed that. Sorry about the original.Glad you found this useful.</description><pubDate>Wed, 28 Jun 2006 13:04:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;Really neat. Thanks.&lt;/P&gt;&lt;P&gt;I appreciated the cut and paste script in the comments. The graphic image of the script in the article was frustrating.&lt;/P&gt;&lt;P&gt;-Robert&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Wed, 28 Jun 2006 07:35:00 GMT</pubDate><dc:creator>Robert Sterbal</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;Good ideas. Just remember that this is still unsupported so don't call Redmond if you have problems with it. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;That's what we're all here for anyway. &lt;img src='images/emotions/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'&gt;&lt;/P&gt;</description><pubDate>Wed, 28 Jun 2006 06:32:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;Take out the sid&amp;gt;1 conditional from the where clause. &lt;/P&gt;&lt;P&gt;One of the readers, Scott, pointed out that the SID=1 means sa created the database and that this isn't a good way to limit tha query to non-system databases. That should solve the problem. You are, as you pointed out, probably excluding all of your user databases as well because they were created by 'sa'.&lt;/P&gt;&lt;P&gt;&lt;FONT face=System&gt;Declare @DBName sysnameDeclare @SqlCmd Nvarchar(2000)Set @DBName = ''&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face=System&gt;While @DBName Is not NULLBegin Select @DBName = Min(Name) From master..sysdatabases &lt;FONT color=#dd1111&gt;&lt;STRONG&gt;Where Name &amp;gt; @DBName&lt;/STRONG&gt;&lt;/FONT&gt; Set @SqlCmd = 'SELECT ''SELECT name AS [File], filename as [File Name]    , CAST(size/128.0 as DECIMAL(10,2)) AS [Size in MB]    , CAST(FILEPROPERTY(name, ''''SpaceUsed'''')/128.0 as DECIMAL(10,2)) as [Space Used]   , CAST(size/128.0-(FILEPROPERTY(name, ''''SpaceUsed'''')/128.0) AS DECIMAL(10,2)) AS [Available Space] FROM SYSFILES'''&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face=System&gt; IF @DBName is NULL Break Exec Master..xp_execresultset @SqlCmd,@DBNameEnd&lt;/FONT&gt;&lt;/P&gt;</description><pubDate>Wed, 28 Jun 2006 06:26:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;Thanks for mentioning that the xp_execresultset is missing from SQL Server 2005.  Yikes!  Before retiring your SQL Server 2000 servers, do this--&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;1) Copy proc sp_execresultset from the master database of any server, and create it in the master database of the SQL Server 2005 server.  (The xp_execresultset is unike other xp_ procs; it isn't compiled and reading it shows that it calls sp_execresultset.)&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;2) Copy proc xp_execresultset from the master database of any server, and create it in the master database of the SQL Server 2005 server, named sp_execresultset2.  (Doesn't work if you name it xp_ -- and, proc can be named sp_ to be called from databases other than master without "exec master.." -- at least that is true in SQL Server 2000.)&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;3) Edit the script to refer to sp_execresultset2 in place of master.dbo.xp_execresultset.&lt;/P&gt;</description><pubDate>Tue, 27 Jun 2006 22:16:00 GMT</pubDate><dc:creator>katesl</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;Two questions:&lt;/P&gt;&lt;P&gt;1: the "sid &amp;gt; 1"  &lt;/P&gt;&lt;P&gt;   If the "sa" create a product database,the sid in the sysdatabases table will be 'Ox01'.Then the command doesn't work well.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;2:the query listed below &lt;/P&gt;&lt;P&gt;Declare @DBName sysnameDeclare @SqlCmd Nvarchar(2000)Set @DBName = ''&lt;/P&gt;&lt;P&gt;While @DBName Is not NULLBegin Select @DBName = Min(Name) From master..sysdatabases Where sid &amp;gt; 1 And Name &amp;gt; @DBName Set @SqlCmd = 'SELECT ''SELECT name AS [File], filename as [File Name]    , CAST(size/128.0 as DECIMAL(10,2)) AS [Size in MB]    , CAST(FILEPROPERTY(name, ''''SpaceUsed'''')/128.0 as DECIMAL(10,2)) as [Space Used]   , CAST(size/128.0-(FILEPROPERTY(name, ''''SpaceUsed'''')/128.0) AS DECIMAL(10,2)) AS [Available Space] FROM SYSFILES'''&lt;/P&gt;&lt;P&gt; IF @DBName is NULL Break Exec Master..xp_execresultset @SqlCmd,@DBNameEnd&lt;/P&gt;&lt;P&gt;It just return "Command(s) completed successfully."&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;img src='images/emotions/sad.gif' height='20' width='20' border='0' title='Sad' align='absmiddle'&gt;&lt;img src='images/emotions/crying.gif' height='20' width='20' border='0' title='Crying' align='absmiddle'&gt;&lt;img src='images/emotions/crying.gif' height='20' width='20' border='0' title='Crying' align='absmiddle'&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Tue, 27 Jun 2006 21:16:00 GMT</pubDate><dc:creator>HelloFOFO</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;I'm not sure how the optimizer would handle them. It would be easy enough to come up with a test query and then execute it via xp_execresultset and a dynamic sql method.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;The main advantage of xp_execresultset is that is allows a query to be run in the context of another database without having to switch the current connection to that context. In the article I used FILEPROPERTY which only runs against the current database. I could do this in dynamic SQL (and someone in the forums of &lt;SPAN id=intelliTXT name="intelliTxt"&gt;Boris Baliner’s article on “Quickly Viewing Available Space” (&lt;A href="http://www.sqlservercentral.com/columnists/bBaliner/quicklyviewingavailablespace.asp"&gt;http://www.sqlservercentral.com/columnists/bBaliner/quicklyviewingavailablespace.asp&lt;/A&gt;) did just that) However, the result was quite long and required a lot of context switching.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&lt;SPAN name="intelliTxt"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&lt;SPAN name="intelliTxt"&gt;I don't know if xp_execresultset can take advantage of caching but I wouldn't use it in any situation where that might be necessary in any case. As I stated, this is an undocumented procedure and Microsoft dropped it in SQL 2005. Using this procedure in an application would be ill-advised. I presented it as a tool for administrators as an alternative to writing long dynamic sql-based scripts.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&lt;SPAN name="intelliTxt"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&lt;SPAN name="intelliTxt"&gt;Yes, it executes under the same SPID. To determine this add a ,@@SPID to the end of the query in the script, as shown below:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 2"&gt;           &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;SET&lt;/SPAN&gt; @SQLCmd&lt;SPAN style="COLOR: gray"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;'SELECT ''SELECT name AS [File],&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;filename as [File Name],&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;CAST(size/128.0 as DECIMAL(10,2)) AS [Size in MB], &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;CAST(FILEPROPERTY(name, ''''SpaceUsed'''')/128.0 as DECIMAL(10,2)) as [Space Used], &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;CAST(size/128.0-(FILEPROPERTY(name, ''''SpaceUsed'''')/128.0) AS DECIMAL(10,2)) AS [Available Space] &lt;STRONG&gt;&lt;EM&gt;,@@SPID&lt;o:p&gt;&lt;/o:p&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: red; FONT-FAMILY: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-tab-count: 3"&gt;                  &lt;/SPAN&gt;FROM SYSFILES'''&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;</description><pubDate>Tue, 27 Jun 2006 14:00:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>Make sense. Thanks for the explanation.</description><pubDate>Tue, 27 Jun 2006 13:10:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;J.T.&lt;/P&gt;&lt;P&gt;Wanted to get your opinion on using this method you proposed versus using Dynamic SQL and say sp_executesql or EXECUTE?&lt;/P&gt;&lt;P&gt;1. does the optimizer handle them diffrently.  &lt;/P&gt;&lt;P&gt;    a. Are they treated as two seperate query plans for the same query or one.&lt;/P&gt;&lt;P&gt;    b. Can &lt;STRONG&gt;XP_EXECRESULTSET &lt;/STRONG&gt;take advantage of the caching of multiple calls from various users that sp_executesql can&lt;/P&gt;&lt;P&gt;    c. do you execute a &lt;STRONG&gt;XP_EXECRESULTSET  &lt;/STRONG&gt;query with the same SPID as the current connection or is a new one made?&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;This is all I can think of off the top of my head anyone have other comparisions to ask let them rip.&lt;/P&gt;</description><pubDate>Tue, 27 Jun 2006 12:51:00 GMT</pubDate><dc:creator>MudLuck</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>I have used NW to do some testing in our prod environments. For example, I wanted to test latency across replicated servers, so I first set up my scripts and jobs, and debugged it using NW. You can't always duplicate a prod environment - at least not with our budget! </description><pubDate>Tue, 27 Jun 2006 11:49:00 GMT</pubDate><dc:creator>RML51</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>Well, on general principle I wouldn't let developers use sp_execresultset as it is undocumented. This means Microsoft may choose to change or remove it, as they did in SQL2005, or not support it in versions where it does exist.As for sql injection, I'm no expert but I am of the belief that a well-written interface would prevent that and not SQL iteself. SQL injection, and someone correct me if I am wrong, is an interface vulnerability and not a SQL one, per se.I'm pretty sure the sp_execresultset stored proc runs under the authority of the current user. The current user, however, must have rights to query the master database table sysdatabases and each database to sysfiles.</description><pubDate>Tue, 27 Jun 2006 11:33:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>You have Pub and Northwind on a production server?Typically, they can be removed as they are demo data and really have no place on a production SQL server. Is there a reason you still have them, if this is a production server?</description><pubDate>Tue, 27 Jun 2006 11:29:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>We have pub and northwind. That's why I used "dbid&amp;gt;6".</description><pubDate>Tue, 27 Jun 2006 11:21:00 GMT</pubDate><dc:creator>RML51</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;I have user databases numbered beginning at 5, system databases respectively are:&lt;/P&gt;&lt;P&gt;1- master&lt;/P&gt;&lt;P&gt;2- tempdb&lt;/P&gt;&lt;P&gt;3- model&lt;/P&gt;&lt;P&gt;4- msdb&lt;/P&gt;&lt;P&gt;5- starts user created dbs&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;so maybe dbid &amp;gt;4?&lt;/P&gt;</description><pubDate>Tue, 27 Jun 2006 11:12:00 GMT</pubDate><dc:creator>SW Skeen</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;What are the security issues of letting application developers use xp_execresultset?  Is it susceptible to SQL Injection?  And if so, wouldn't it run under the authority of the SQL Server owner?&lt;/P&gt;</description><pubDate>Tue, 27 Jun 2006 10:49:00 GMT</pubDate><dc:creator>Kirk Condon</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>You could try replacing the "sid&amp;gt;1" with "dbid&amp;gt;6". I think that works, too.</description><pubDate>Tue, 27 Jun 2006 10:07:00 GMT</pubDate><dc:creator>RML51</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;Thanks for taking the time to raise questions, Scott. Glad to help.&lt;/P&gt;&lt;P&gt;The SID column is the SID of the creator. Scott pointed out that some servers may have databases that were created by sid=1 (sa) and would be excluded by this logic. &lt;/P&gt;&lt;P&gt;My intent was to prevent the system databases from appearing. &lt;img src='images/emotions/pinch.gif' height='20' width='20' border='0' title='Pinch' align='absmiddle'&gt;&lt;/P&gt;&lt;P&gt;To see all the databases, including the system databases, remove the &lt;STRONG&gt;sid&amp;gt;1&lt;/STRONG&gt; conditonal.&lt;/P&gt;&lt;P&gt;Conversely, you can restrain the results by changing the &lt;STRONG&gt;sid&amp;gt;1&lt;/STRONG&gt; phrase to &lt;STRONG&gt;name not in ('msdb','master','tempdb') &lt;/STRONG&gt;or whatever databases you want to exclude.&lt;/P&gt;</description><pubDate>Tue, 27 Jun 2006 09:41:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item><item><title>RE: Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>&lt;P&gt;After exchanging questions with J.T. this morning I am including the information as additonal information...&lt;/P&gt;&lt;P&gt;Since the SID column is the SID of the db creator this column may not be useful in this script for comparison of SID&amp;gt;1. The issue I encountered and discussed was that all my databases, save one, were created by sa so the SID column was 1 for all of them, only the database created under my individual user ID had a SID &amp;gt;1. J.T.'s solution is to replace the comparison with the follwing statement.&lt;/P&gt;&lt;P&gt;&lt;FONT size=2&gt;SELECT NAME FROM MASTER..SYSDATABASES WHERE NAME NOT IN&lt;/P&gt;&lt;P&gt;('MSDB','MASTER','TEMPDB')&lt;/P&gt;&lt;P&gt; I thank J.T. again for a wonderful article and responsiveness to queries about my results.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;edited to fix tipos...&lt;/P&gt;&lt;/FONT&gt;</description><pubDate>Tue, 27 Jun 2006 09:33:00 GMT</pubDate><dc:creator>SW Skeen</dc:creator></item><item><title>Using XP_EXECRESULTSET To Obtain Database Size Information and More</title><link>http://www.sqlservercentral.com/Forums/Topic287593-312-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF="http://www.sqlservercentral.com/columnists/jtshyman/usingxp_execresultsettoobtaindatabasesizeinformati.asp"&gt;http://www.sqlservercentral.com/columnists/jtshyman/usingxp_execresultsettoobtaindatabasesizeinformati.asp&lt;/A&gt;</description><pubDate>Wed, 14 Jun 2006 18:38:00 GMT</pubDate><dc:creator>J.T. Shyman</dc:creator></item></channel></rss>