<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The SQL Agent Man &#187; Tech</title>
	<atom:link href="http://thesqlagentman.com/tag/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://thesqlagentman.com</link>
	<description>Some call me... TIM!</description>
	<lastBuildDate>Tue, 27 Jul 2010 14:26:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Return Index Column Metadata for All User Tables</title>
		<link>http://thesqlagentman.com/2009/06/return-index-column-metadata-for-all-user-tables/</link>
		<comments>http://thesqlagentman.com/2009/06/return-index-column-metadata-for-all-user-tables/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 20:54:17 +0000</pubDate>
		<dc:creator>Timothy Ford</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Syndicated]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Things that won't impress your friends]]></category>

		<guid isPermaLink="false">http://www.ford-it.com/sqlagentman/?p=297</guid>
		<description><![CDATA[Need to return information on all indexes for a selected SQL Server database.  Here is the code!]]></description>
			<content:encoded><![CDATA[<p>Ok, no bling in this post, just a down-and-dirty method to use the system catalog views to return all columns and associated metadata for the current database.</p>
<h5><span class="pln">SELECT OBJECT_SCHEMA_NAME(T.[object_id],DB_ID()) AS [Schema],  <br />
  T.[name] AS [table_name], I.[name] AS [index_name], <br />
  AC.[name] AS [column_name], I.[type_desc], I.[is_unique], <br />
  I.[data_space_id], I.[ignore_dup_key], I.[is_primary_key],<br />
  I.[is_unique_constraint], I.[fill_factor],    I.[is_padded], I.[is_disabled], <br />
  I.[is_hypothetical], I.[allow_row_locks], I.[allow_page_locks], <br />
  IC.[is_descending_key], IC.[is_included_column]<br />
FROM sys.[tables] AS T  <br />
  INNER JOIN sys.[indexes] I ON T.[object_id] = I.[object_id]   <br />
  INNER JOIN sys.[index_columns] IC ON I.[object_id] = IC.[object_id] <br />
   AND I.[index_id] = IC.[index_id]<br />
  INNER JOIN sys.[all_columns] AC ON T.[object_id] = AC.[object_id] <br />
   AND IC.[column_id] = AC.[column_id]<br />
WHERE T.[is_ms_shipped] = 0 AND I.[type_desc] &lt;&gt; &#8217;HEAP&#8217;<br />
ORDER BY T.[name], I.[index_id], IC.[key_ordinal] </span><span class="pln"><br />
</span></h5>
]]></content:encoded>
			<wfw:commentRss>http://thesqlagentman.com/2009/06/return-index-column-metadata-for-all-user-tables/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
