<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Developing Matt</title>
	<atom:link href="http://mattclingan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattclingan.wordpress.com</link>
	<description>My Technical Journal</description>
	<lastBuildDate>Wed, 18 Jan 2012 23:38:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mattclingan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Developing Matt</title>
		<link>http://mattclingan.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mattclingan.wordpress.com/osd.xml" title="Developing Matt" />
	<atom:link rel='hub' href='http://mattclingan.wordpress.com/?pushpress=hub'/>
		<item>
		<title>32 bit Twice Shy</title>
		<link>http://mattclingan.wordpress.com/2012/01/18/32-bit-twice-shy/</link>
		<comments>http://mattclingan.wordpress.com/2012/01/18/32-bit-twice-shy/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 23:37:00 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/?p=311</guid>
		<description><![CDATA[&#160; If you sql server is running 64 bit and your ssis is using something other than a 64 bit provider you might receive an error with your job.&#160; SSIS Error Code DTS_E_OLEDB_NOPROVIDER_64BIT_ERROR.&#160; The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered &#8212; perhaps no 64-bit provider is available Error code: 0&#215;00000000.&#160; An OLE DB [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=311&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>If you sql server is running 64 bit and your ssis is using something other than a 64 bit provider you might receive an error with your job.&#160; </p>
<p>SSIS Error Code DTS_E_OLEDB_NOPROVIDER_64BIT_ERROR.&#160; The requested OLE DB provider Microsoft.Jet.OLEDB.4.0 is not registered &#8212; perhaps no 64-bit provider is available Error code: 0&#215;00000000.&#160; An OLE DB record is available.&#160; Source: &quot;Microsoft OLE DB Service Components&quot;&#160; Hresult: 0&#215;80040154&#160; Description: &quot;Class not registered&quot;.&#160; End Error&#160; Error: 2012-01-18 11:58:16.53&#160;&#160;&#160;&#160; Code: 0xC020801C&#160;&#160;&#160;&#160; Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.&#160; </p>
<p>Change the step on your job (the one executing your ssis package) to <strong>Use 32 bit runtime</strong> (Execution options tab).&#160; Jet is not 64 bit, therefore you have to change your step to run it as a 32 bit application.</p>
<p><img title="ssis32bit" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="613" alt="ssis32bit" src="http://mattclingan.files.wordpress.com/2012/01/ssis32bit.jpg?w=708&#038;h=613" width="708" border="0" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/311/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=311&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2012/01/18/32-bit-twice-shy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>

		<media:content url="http://mattclingan.files.wordpress.com/2012/01/ssis32bit.jpg" medium="image">
			<media:title type="html">ssis32bit</media:title>
		</media:content>
	</item>
		<item>
		<title>Sensitive SSIS and Encryption</title>
		<link>http://mattclingan.wordpress.com/2012/01/18/sensitive-ssis-and-encryption/</link>
		<comments>http://mattclingan.wordpress.com/2012/01/18/sensitive-ssis-and-encryption/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 23:20:00 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/?p=315</guid>
		<description><![CDATA[If you ENCRYPT SENSITIVE DATA WITH USER KEY everything will work fine until you import and run the job.&#160; You might get: Failed to decrypt protected XML node &#34;DTS:Password&#34; with error 0x8009000B &#34;Key not valid for use in specified state.&#34;. You may not be authorized to access this information. This error occurs when there is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=315&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you ENCRYPT SENSITIVE DATA WITH USER KEY everything will work fine until you import and run the job.&#160; You might get: </p>
<p><em>Failed to decrypt protected XML node &quot;DTS:Password&quot; with error 0x8009000B &quot;Key not valid for use in specified state.&quot;. You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.</em></p>
<p>If you set it to be a password (ENCRYPT SENSITIVE WITH USER KEY)) and don’t set up that password when setting up the job you will get:</p>
<p><em>Failed to decrypt an encrypted XML node because the password was not specified or not correct. </em></p>
<p><em>Description: SSIS Error Code DTS_E_OLEDBERROR.&#160; An OLE DB error has occurred. Error code: 0x80040E4D.&#160; An OLE DB record is available.&#160; Source: &quot;Microsoft SQL Server Native Client 10.0&quot;&#160; Hresult: 0x80040E4D&#160; Description: &quot;Login failed for user .&quot;.&#160; </em></p>
<p>The way I like to do it is to set it at ENCRYPT SENSITIVE WITH USER KEY which will enable the passwords to be saved in the package for development and upon import change the encryption to use Rely on server storage and roles for access control which will use the permissions inherent to the job owner.</p>
<p><img title="New Picture (8)" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="193" alt="New Picture (8)" src="http://mattclingan.files.wordpress.com/2012/01/newpicture8.jpg?w=382&#038;h=193" width="382" border="0" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/315/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=315&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2012/01/18/sensitive-ssis-and-encryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>

		<media:content url="http://mattclingan.files.wordpress.com/2012/01/newpicture8.jpg" medium="image">
			<media:title type="html">New Picture (8)</media:title>
		</media:content>
	</item>
		<item>
		<title>Write to a text file without xp_cmdshell</title>
		<link>http://mattclingan.wordpress.com/2012/01/14/write-to-a-text-file-without-xp_cmdshell/</link>
		<comments>http://mattclingan.wordpress.com/2012/01/14/write-to-a-text-file-without-xp_cmdshell/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 23:57:00 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[T-Sql]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/?p=308</guid>
		<description><![CDATA[There are dangers of xp_cmdshell.&#160; If turned on you can execute some pretty nasty commands.&#160; Combine that with a poorly written dynamic sql procedure and you have a hackers delight.&#160; It’s a window to the windows of the machine’s soul. Many places don’t turn it on, and attempts to use it will give you: SQL [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=308&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are dangers of xp_cmdshell.&#160; If turned on you can execute some pretty nasty commands.&#160; Combine that with a poorly written dynamic sql procedure and you have a hackers delight.&#160; It’s a window to the windows of the machine’s soul.</p>
<p>Many places don’t turn it on, and attempts to use it will give you:</p>
<p>SQL Server blocked access to procedure &#8216;sys.xp_cmdshell&#8217; of component &#8216;xp_cmdshell&#8217; because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of &#8216;xp_cmdshell&#8217; by using sp_configure. For more information about enabling &#8216;xp_cmdshell&#8217;, see &quot;Surface Area Configuration&quot; in SQL Server Books Online.</p>
<p>I don’t blame them.&#160; Unfortunately it takes out an opportunity to combine it with bcp and write to a file.&#160; </p>
<p>The way you can bypass this is by using a job, adding a step that has a cmdExec step that executes bcp to write to a file.&#160; </p>
<p>bcp &quot;select field1, field2 from server.database.dbo.table&quot;&#160; queryout &quot;c:\test.txt&quot; -T –c</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms162802.aspx" target="_blank">bcp bol</a></p>
<p>I’m still trying to understand ole automation, which isn’t turned on either.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/308/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/308/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/308/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=308&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2012/01/14/write-to-a-text-file-without-xp_cmdshell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>
	</item>
		<item>
		<title>Unicorns are MAGIC!</title>
		<link>http://mattclingan.wordpress.com/2012/01/13/unicorns-are-magic/</link>
		<comments>http://mattclingan.wordpress.com/2012/01/13/unicorns-are-magic/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 12:32:00 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[SSIS]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/?p=305</guid>
		<description><![CDATA[What is the difference between unicode and non-unicode character types?&#160; Which one should I use? Nvarchar (unicode) or Varchar (non-unicode)? If you can use non-unicode use it as it will be smaller and quicker (generally 70% smaller footprint), but if you need things like é or support other languages use unicode. Unicode is the UNIVERSAL [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=305&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>What is the difference between unicode and non-unicode character types?&#160; Which one should I use? Nvarchar (unicode) or Varchar (non-unicode)?</p>
<p>If you can use non-unicode use it as it will be smaller and quicker (generally 70% smaller footprint), but if you need things like é or support other languages use unicode.</p>
<p>Unicode is the UNIVERSAL encoding system.&#160; This is supported by a non-profit organization (<a href="http://unicode.org/consortium/consort.html" target="_blank">Unicode Consortium</a>) to ensure that we can all understand each other clearly…not just internationally but historically as well.</p>
<p>To help you remember, the N in front of nvarchar or nchar stands for the <u>National language character</u> set (i.e. unicode).&#160; If your data structure might possibly expand to other languages, set it up to use a unicode datatype.&#160; </p>
<p>If you work with ssis at all you have likely seen the error &quot;Cannot Convert between Unicode and Non Unicode String Data Type&quot;    <br />If you are going from non-unicode (varchar or char) to unicode (nvarchar or nchar) you will benefit transforming the data with the&#160; unicode string [dt_wstr] or unicode text stream [dt_ntext] depending on how lengthy the field is..&#160; </p>
<p>There is no reason for such a silly title or for the picture below except to make you think this post would be something interesting to read.&#160; There is no relationship between unicode and unicorns, nor will there ever be.</p>
<p><img src="http://www.unicorns.com/images/indigosea2c.jpg" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/305/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/305/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=305&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2012/01/13/unicorns-are-magic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>

		<media:content url="http://www.unicorns.com/images/indigosea2c.jpg" medium="image" />
	</item>
		<item>
		<title>Database Info in HTML format</title>
		<link>http://mattclingan.wordpress.com/2012/01/10/database-info-in-html-format/</link>
		<comments>http://mattclingan.wordpress.com/2012/01/10/database-info-in-html-format/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 22:29:00 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[T-Sql]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/?p=303</guid>
		<description><![CDATA[Someone gave this to me back in 2007.&#160; I don’t know the source.&#160; It doesn’t completely work and needs some fixing, but it gives you everything you ever wanted to know about a database in html format &#8211; users, tables, views, sprocs, etc.&#160; It will alleviate you having to search the database for everything yourself.&#160;&#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=303&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Someone gave this to me back in 2007.&#160; I don’t know the source.&#160; It doesn’t completely work and needs some fixing, but it gives you everything you ever wanted to know about a database in html format &#8211; users, tables, views, sprocs, etc.&#160; It will alleviate you having to search the database for everything yourself.&#160;&#160; Run it and output results to a file ending in html, then open it.&#160; Even with the errors you can get an idea of what it is doing.&#160; Some rainy day I’ll need this and then I’ll fix it and you will see it’s worth, which is most of the stuff in my garage.</p>
<p>This is akin to me finding a broken <em>something</em> in the attic that I made from my childhood and trying to convince you it’s worth something.&#160;&#160;&#160; Enjoy!</p>
<p><a href="http://www.mattclingan.com/downloadthis/mattclinganwordpress/HTMLdatabaseinfo.sql.txt" target="_blank">link</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/303/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=303&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2012/01/10/database-info-in-html-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>
	</item>
		<item>
		<title>If you can&#8217;t obtain dbschema_tables_info</title>
		<link>http://mattclingan.wordpress.com/2011/12/29/if-you-cant-obtain-dbschema_tables_info/</link>
		<comments>http://mattclingan.wordpress.com/2011/12/29/if-you-cant-obtain-dbschema_tables_info/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 13:12:00 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[T-Sql]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/?p=298</guid>
		<description><![CDATA[&#160; After creation of a new linked server (from 2008 sql box to 2000 sql box). I tested my select query and received Cannot obtain the schema rowset &#34;DBSCHEMA_TABLES_INFO&#34; for OLE DB provider &#34;SQLNCLI10&#34; for linked server &#34;LINKEDSERVERNAME&#34;. The provider supports the interface, but returns a failure code when it is used. KB article here [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=298&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>After creation of a new linked server (from 2008 sql box to 2000 sql box). I tested my select query and received</p>
<p>Cannot obtain the schema rowset &quot;DBSCHEMA_TABLES_INFO&quot; for OLE DB provider &quot;SQLNCLI10&quot; for linked server &quot;LINKEDSERVERNAME&quot;. The provider supports the interface, but returns a failure code when it is used.</p>
<p>KB article <a href="http://support.microsoft.com/kb/906954" target="_blank">here</a> suggests an update to the 2k box.&#160; </p>
<p>Pinal Dave suggests something that doesn’t apply to me <a href="http://blog.sqlauthority.com/2007/05/04/sql-server-fix-error-msg-7311-level-16-state-2-line-1-cannot-obtain-the-schema-rowset-dbschema_tables_info-for-ole-db-provider-sqlncli-for-linked-server-linkedservername/" target="_blank">here</a>.&#160; </p>
<p>For me, I was unable to update the sql box so I had to depend on openquery (<a href="http://msdn.microsoft.com/en-us/library/ms188427.aspx" target="_blank">link</a>).&#160; Openquery is pretty picky on it’s syntax, so if you get this</p>
<p>&quot;Deferred prepare could not be completed.&quot;</p>
<p>Try applying a few brackets:</p>
<p>SELECT *   <br />FROM OPENQUERY(linkedServerName,&#8217;select *&#160;&#160; FROM [linkedservername].[database].[dboorwhateverschema].[table]&#8216;)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/298/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/298/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=298&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2011/12/29/if-you-cant-obtain-dbschema_tables_info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>
	</item>
		<item>
		<title>Nil on Sending Nil</title>
		<link>http://mattclingan.wordpress.com/2011/11/30/nil-on-sending-nil/</link>
		<comments>http://mattclingan.wordpress.com/2011/11/30/nil-on-sending-nil/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 23:02:23 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[VB.net]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/?p=296</guid>
		<description><![CDATA[Some things fall into a category that I don’t know how to explain.&#160; I struggled for some time with a project that was sending some data using a web service method call.&#160; The problem arose: I needed to send a null value in one of the parameters and unfortunately the documentation was so poor on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=296&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Some things fall into a category that I don’t know how to explain.&#160; I struggled for some time with a project that was sending some data using a web service method call.&#160; The problem arose: I needed to send a null value in one of the parameters and unfortunately the documentation was so poor on this web service.&#160; It didn’t discuss how to pass a null value.&#160; That is to say, there was nil on how to send a nil.</p>
<p>After some time agonizing over this I was able to use a different application to call the webservice without the use of the parameter, which enabled me to track what was being sent.</p>
<p>So for this particular web api the way you can do it is by adding another property to the node and leave the value empty:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ParameterName xsi:nil=&quot;true&quot;/&gt;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/296/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=296&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2011/11/30/nil-on-sending-nil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>
	</item>
		<item>
		<title>Calling Reports via URL take II</title>
		<link>http://mattclingan.wordpress.com/2011/11/30/calling-reports-via-url-take-ii/</link>
		<comments>http://mattclingan.wordpress.com/2011/11/30/calling-reports-via-url-take-ii/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 22:23:32 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Report Services]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/?p=293</guid>
		<description><![CDATA[Previously I had posted advice here on how to link to a report via url.&#160; I have some more information for you to assist you (me) with this venture.&#160; Some organizations choose to use IIS rather than use just the web service URL to enable the use of sharepoint as a UI.&#160; Consequently the directory [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=293&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Previously I had posted advice <a href="/2007/11/20/calling-reports-via-url/" target="_blank">here</a> on how to link to a report via url.&#160; I have some more information for you to assist you (me) with this venture.&#160; Some organizations choose to use IIS rather than use just the web service URL to enable the use of sharepoint as a UI.&#160; Consequently the directory takes a funny look:&#160; </p>
<p>Previously the link looked like this</p>
<p>http://SERVERNAME/ReportServer/?%DIRECTORYNAME%REPORTNAME&amp;rs:Command=Render</p>
<p>However, if you enable viewing the report from sharepoint it has to be fed from IIS.&#160; Therefore the DirectoryName becomes root website followed by the directory, etc.&#160; Also, note, that SERVERNAME can be the servername but it IS the sqlserver name:</p>
<p>http://servername/ReportServer/?http://website/Directory/Reports/ReportName.rdl&amp;rs:Command=Render</p>
<p>One thing to note, there is no way to go to the website directly.&#160; You have to fully qualify the server name.&#160; Confused yet?&#160; If interested here is the configuration of the reports:</p>
<p><img title="ReportServicesConfig" style="display:inline;border-width:0;" height="725" alt="ReportServicesConfig" src="http://mattclingan.files.wordpress.com/2011/11/reportservicesconfig.jpg?w=963&#038;h=725" width="963" border="0" /> </p>
<p>So here is the full range of possibilities and examples:</p>
<p><strong>Render to PDF using HTML Report Viewer with Sharepoint Report      <br /></strong>http://servername/ReportServer/?http://website/Directory/Reports/ReportName.rdl&amp;rc:Parameters=false&amp;Parameter=ParameterValue&amp;rs:Format=PDF&amp;rs:Command=Render</p>
<p><strong>Render with SharePoint Viewer (nicer look than HTML)      <br /></strong>http://website/Directory/_layouts/ReportServer/RSViewerPage.aspx?rv:RelativeReportUrl=/Directory/reports/ReportName.rdl&amp;rv:ParamMode=Hidden&amp;rp:Parameter=ParameterValue</p>
<p><strong>Render Directly to PDF with HTML Viewer      <br /></strong>http://servername/ReportServer/Pages/ReportViewer.aspx?http%3a%2f%2fwebsite%2fDirectory%2fReports%2fReportName.rdl&amp;rs:Command=Render&amp;rs:Format=PDF</p>
<p><strong>Render using HTML Viewer      <br /></strong>http://servername/ReportServer/Pages/ReportViewer.aspx?http://website/Directory/Reports/ReportName.rdl&amp;rc:Parameters=false&amp;rs:Command=Render&amp;Parameter=ParameterValue</p>
<p>Thanks Chris for your assistance with this stuff!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/293/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/293/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=293&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2011/11/30/calling-reports-via-url-take-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>

		<media:content url="http://mattclingan.files.wordpress.com/2011/11/reportservicesconfig.jpg" medium="image">
			<media:title type="html">ReportServicesConfig</media:title>
		</media:content>
	</item>
		<item>
		<title>The Whacks behave differently, unless you give them some action.</title>
		<link>http://mattclingan.wordpress.com/2011/11/21/the-whacks-behave-differently-unless-you-give-them-some-action/</link>
		<comments>http://mattclingan.wordpress.com/2011/11/21/the-whacks-behave-differently-unless-you-give-them-some-action/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 21:22:58 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/?p=290</guid>
		<description><![CDATA[Had an interesting&#160; situation where utilizing http://websitename/ behaved differently than http://websitename/default.aspx even though the default.aspx page was being used in both instances.&#160; I was using a third party ( infragistics ) grid that was depending on a client script to sort.&#160; When I sorted the page from http://websitename/ it failed, gave me an error stating [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=290&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Had an interesting&#160; situation where utilizing <a href="http://websitename/">http://websitename/</a> behaved differently than <a href="http://websitename/default.aspx">http://websitename/default.aspx</a> even though the default.aspx page was being used in both instances.&#160; I was using a third party ( infragistics ) grid that was depending on a client script to sort.&#160; When I sorted the page from <a href="http://websitename/">http://websitename/</a> it failed, gave me an error stating ‘instance not found’ in the javascript.&#160; When I sorted from <a href="http://websitename/default.aspx">http://websitename/default.aspx</a> it worked without a hitch.</p>
<p>At first I thought it was a cacheing issue…that my scripts weren’t being downloaded on even a hard refresh.&#160; But such was not the case.&#160; After some deliberation I turned to senior developer Chris.&#160; He thought for a while and eventually told me to add an action property in the form tag like thus: </p>
<p>&lt;form id=&quot;form1&quot; <strong>action=&quot;default.aspx&quot;</strong> runat=&quot;server&quot;&gt;</p>
<p>This worked.&#160; It enabled the scripts to find default.aspx and utilize the page properties.&#160; I asked for an explanation. Developer Chris said it had something to do with the new IIS 7 and how it has some feature which enables the whacks (/) to behave differently…and to change this behavior would require some add-in on this IIS console.&#160; </p>
<p>If you view the source of a page and look at the action property it will usually be <strong>action=””</strong> which isn’t helpful for a script looking for it.&#160; So by specifying the action you can leave the whacks as they are.</p>
<p>&#160;</p>
<p><a href="http://www.mattclingan.com/"><img title="20100326105835_2010_03_08_kcsunrisekawpark%20(166)" style="border-right:0;border-top:0;display:inline;border-left:0;border-bottom:0;" height="504" alt="20100326105835_2010_03_08_kcsunrisekawpark%20(166)" src="http://mattclingan.files.wordpress.com/2011/11/20100326105835_2010_03_08_kcsunrisekawpark20166.jpg?w=752&#038;h=504" width="752" border="0" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/290/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=290&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2011/11/21/the-whacks-behave-differently-unless-you-give-them-some-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>

		<media:content url="http://mattclingan.files.wordpress.com/2011/11/20100326105835_2010_03_08_kcsunrisekawpark20166.jpg" medium="image">
			<media:title type="html">20100326105835_2010_03_08_kcsunrisekawpark%20(166)</media:title>
		</media:content>
	</item>
		<item>
		<title>Pivot Without Aggregation or Aggravation</title>
		<link>http://mattclingan.wordpress.com/2011/11/02/pivot-without-aggregation-or-aggravation/</link>
		<comments>http://mattclingan.wordpress.com/2011/11/02/pivot-without-aggregation-or-aggravation/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 22:09:01 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[T-Sql]]></category>
		<category><![CDATA[PIVOT]]></category>

		<guid isPermaLink="false">https://mattclingan.wordpress.com/2011/11/02/pivot-without-aggregation-or-aggravation/</guid>
		<description><![CDATA[I needed to flip my data horizontally.&#160; I didn&#8217;t need to aggregate anything.&#160; I was just working with a user that wanted the data to look different. Instead of this Car Tire Car Window Car Wipers Car Engine Car Air Freshener &#160; He wanted &#160; col1 col2 col3 col4 col5 Car Tire Window Wipers Engine [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=283&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I needed to flip my data horizontally.&#160; I didn&#8217;t need to aggregate anything.&#160; I was just working with a user that wanted the data to look different. </p>
<p>Instead of this </p>
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td width="150">Car</td>
<td width="173">Tire</td>
</tr>
<tr>
<td>Car</td>
<td>Window</td>
</tr>
<tr>
<td>Car</td>
<td>Wipers</td>
</tr>
<tr>
<td>Car</td>
<td>Engine</td>
</tr>
<tr>
<td>Car</td>
<td>Air Freshener</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p>He wanted</p>
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td width="150">&#160;</td>
<td width="173">col1</td>
<td width="173">col2</td>
<td width="173">col3</td>
<td width="173">col4</td>
<td width="173">col5</td>
</tr>
<tr>
<td>Car</td>
<td>Tire</td>
<td>Window</td>
<td>Wipers</td>
<td>Engine</td>
<td>Air Freshener</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p>The pivot command requires an aggregate.&#160; It&#8217;s the basis of the command. When you are pivoting you are saying &#8216;hey give me some number crunching for this particular arrangement of data: </p>
<p>PIVOT (calculation(on what) for the following column headings (column A, column B, column C) as pvt </p>
<p>So how can this be done without aggregating?&#160; Well if your group has only one calculation then you can do whatever calculation you want.&#160; For example, the average of 62 will always be 62.&#160; So using the rownumber in conjunction with a max on a string we can cheat and get the pivot command to give us what we want.</p>
<p>I was so close to figuring this out when I found a great post by Arie Stern <a href="http://www.sqlmag.com/article/tsql3/pivoting-without-aggregation" target="_blank">here</a>.&#160; I used his post to get this concept working.&#160; Thank you Mr. Stern for your assistance.</p>
<p>Set up your table here for this example:</p>
<blockquote><p>create table #rrr(vehicle varchar(20), part varchar(20))     <br />insert into #rrr values(&#8216;CAR&#8217;,'Tire&#8217;)      <br />insert into #rrr values(&#8216;CAR&#8217;,'Window&#8217;)      <br />insert into #rrr values(&#8216;CAR&#8217;,'Wiper&#8217;)      <br />insert into #rrr values(&#8216;CAR&#8217;,'Engine&#8217;)      <br />insert into #rrr values(&#8216;CAR&#8217;,'Air Freshener&#8217;)      <br />Select * from #rrr</p>
</blockquote>
<p>The way to pivot this data is as follows:</p>
<blockquote><p>select vehicle, [1], [2], [3],[4],[5]     <br />from      <br />(Select vehicle, part, Row_number() over (partition by vehicle order by vehicle) as rownum from #rrr)      <br />a      <br />pivot (max(part) for rownum in ([1],[2],[3],[4],[5])) as pvt</p>
</blockquote>
<p>Note that I am using the rownumber to get my column headings and am using max for the part types.&#160; So this works great, of course, only if you know how many rows there are per vehicle.&#160; Restated: the above works only because I know there are only 5 rows of data. Data is hardly this friendly.&#160; So the catch is: if you don&#8217;t know how many rows you will have you will have to build your sql out of dynamic sql.&#160; If you are careful you won&#8217;t be writing dynamic sql inside of dynamic sql which will either drive you mad or will drive the person mad behind you that has to maintain your code.&#160; Regardless, here is how you would do it.&#160; :</p>
<p>&#8212;&#8212;&#8212;-step 1: set up your column names based upon rownumber&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-   <br />declare @rownum varchar(50)    <br />set @rownum = &#8221;    <br />select @rownum = @rownum + &#8216;[' +&#160; cast(rownum as char(1))+ '],&#8217;     <br />from     <br />(Select vehicle, part, Row_number() over (partition by vehicle order by vehicle) as rownum from #rrr)    <br />a    <br />set @rownum = left(@rownum, len(@rownum)-1)    <br />print @rownum     <br />&#8211;Note that i’m using brackets around column headings.&#160; You could add a more descriptive     <br />&#8211;column name but will have to cast your rownumbers later on (Just wanted to keep it as simple as possible).    <br />&#8211;Also, note that you have to strip the last comma from your column list</p>
<p>&#8212;&#8212;&#8212;-step 2: create and call your dynamic sql using your new rownumber variable&#8212;&#8212;&#8212;&#8211;   <br />declare @sql varchar(1000)    <br />set @sql =    <br />&#8216;SELECT vehicle, &#8216; + @rownum + &#8216;     <br />from     <br />(Select vehicle, part, Row_number() over (partition by vehicle order by vehicle) as rownum from #rrr    <br />) a    <br />pivot (max(part) for rownum in (&#8216; + @rownum + &#8216;)) as pvt&#160;&#160;&#160; <br />&#8216;    <br /> print @sql    <br />execute (@sql) </p>
<p><a href="http://mattclingan.com/index.php?showimage=482"><img title="Watercolors 1" height="533" alt="Watercolors 1" src="http://mattclingan.com/images/20111003144127_img_5308b (medium).jpg" width="800" border="0" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mattclingan.wordpress.com/283/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mattclingan.wordpress.com/283/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mattclingan.wordpress.com/283/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mattclingan.wordpress.com/283/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mattclingan.wordpress.com/283/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mattclingan.wordpress.com/283/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mattclingan.wordpress.com/283/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mattclingan.wordpress.com/283/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mattclingan.wordpress.com/283/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mattclingan.wordpress.com/283/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mattclingan.wordpress.com/283/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mattclingan.wordpress.com/283/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mattclingan.wordpress.com/283/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mattclingan.wordpress.com/283/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mattclingan.wordpress.com&amp;blog=2774390&amp;post=283&amp;subd=mattclingan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mattclingan.wordpress.com/2011/11/02/pivot-without-aggregation-or-aggravation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">matt</media:title>
		</media:content>

		<media:content url="http://mattclingan.com/images/20111003144127_img_5308b(medium).jpg" medium="image">
			<media:title type="html">Watercolors 1</media:title>
		</media:content>
	</item>
	</channel>
</rss>
