<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Rudy Rodarte . com</title>
	
	<link>http://www.rodolforodarte.com</link>
	<description>Follow Rudy as he programs, travels and designs.</description>
	<lastBuildDate>Wed, 15 Feb 2012 16:54:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RudyRodarteCom" /><feedburner:info uri="rudyrodartecom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Enable CLR on SQL Server</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/YfdOuf7wA74/</link>
		<comments>http://www.rodolforodarte.com/2012/02/enable-clr-on-sql-server/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 20:29:26 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[CLR]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=7259</guid>
		<description><![CDATA[Learn how to enable .NET CLR on SQL Server. ]]></description>
			<content:encoded><![CDATA[<p>I ran into a case where CLR was disabled on one of my servers. If you don&#8217;t know what CLR is, in a nutshell, you can run VB or C# code on your SQL Server.<br />
<a href="http://msdn.microsoft.com/en-us/library/w2kae45k(v=vs.80).aspx">Here is a sample CLR procedure from MSDN that calculates sales taxes.</a><br />
But, back to enabling CLR on your SQL Server. There is a simple command you can use to enable CLR on your SQL Server.</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #AF0000;">sp_configure</span> <span style="color: #FF0000;">'show advanced options'</span>, <span style="color: #000;">1</span>;
GO
<span style="color: #0000FF;">RECONFIGURE</span>;
GO
<span style="color: #AF0000;">sp_configure</span> <span style="color: #FF0000;">'clr enabled'</span>, <span style="color: #000;">1</span>;
GO
<span style="color: #0000FF;">RECONFIGURE</span>;
GO</pre></div></div>

<p>To check and make sure that CLR is enabled, simply run this select statement:</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">select</span>  <span style="color: #808080;">*</span>
<span style="color: #0000FF;">from</span>    sys.<span style="color: #202020;">configurations</span>
<span style="color: #0000FF;">where</span>   name <span style="color: #808080;">=</span> <span style="color: #FF0000;">'clr enabled'</span></pre></div></div>

<p>Source: <a href="http://msdn.microsoft.com/en-us/library/ms131048.aspx">MSDN &#8211; Enabling CLR Integration</a></p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/YfdOuf7wA74" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2012/02/enable-clr-on-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2012/02/enable-clr-on-sql-server/</feedburner:origLink></item>
		<item>
		<title>Remote Desktop won’t go back to Full Screen Part 2</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/21n86k_0vig/</link>
		<comments>http://www.rodolforodarte.com/2011/10/remote-desktop-won%e2%80%99t-go-back-to-full-screen-part-2/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 16:22:24 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[autohotkey]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[RDP]]></category>
		<category><![CDATA[Remote Desktop]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[Windows 7 x64]]></category>
		<category><![CDATA[Windows XP]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=7241</guid>
		<description><![CDATA[Learn how to use AutoHotKey to resize your remote desktop sessions back to full screen after minimization in Windows. Never deal with scroll bars in RDP again!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rodolforodarte.com/wp-content/uploads/2011/10/ScrollScrollScroll.png"><img class="aligncenter size-medium wp-image-7246" title="ScrollScrollScroll" src="http://www.rodolforodarte.com/wp-content/uploads/2011/10/ScrollScrollScroll-300x171.png" alt="" width="300" height="171" /></a><br />
Earlier this year, I wrote about <a href="http://www.rodolforodarte.com/2010/06/remote-desktop-wont-go-back-to-full-screen-after-mnimization-in-windows-7/">Remote Desktop not returning to fullscreen after minimization in Windows 7</a>. The solution is to use Control-Alt-Break to bring the remote desktop window to full screen. And life was grand. I noticed some comments that people had Laptops where their keyboard did not have a Break key.<br />
<span id="more-7241"></span><br />
<div id="attachment_7247" class="wp-caption aligncenter" style="width: 310px"><a href="http://windows.microsoft.com/en-US/windows-xp/help/on-screen-keyboard"><img src="http://www.rodolforodarte.com/wp-content/uploads/2011/10/OSK-300x86.png" alt="On Screen Keyboard" title="OSK" width="300" height="86" class="size-medium wp-image-7247" /></a><p class="wp-caption-text">Could this help?</p></div></p>
<p>I thought that the On Screen Keyboard would work, but I heard that the break key on the On Screen Keyboard didn&#8217;t work. I didn&#8217;t have time to research, so I left the no break key issue to those that actually didn&#8217;t have a break key.<br />
Fast forward a few weeks, and I myself got a Dell XPS 15 which, as luck would have it, does not have a break key. So, here I am again, tackling the same issue. This time, the solution takes a bit of software.<br />
At work, I use a program called <a href="http://www.autohotkey.com/">AutohotKey</a> to script things out, like my signature. So, RR expands to<br />
Thanks,<br />
Rudy Rodarte</p>
<p>AutoHotKey can also remap keys send commands. Here are a few links showing the different things AutoHotKey can do:<br />
<a href="http://www.autohotkey.com/docs/Hotkeys.htm">Hot Keys</a><br />
<a href="http://www.autohotkey.com/docs/misc/Remap.htm">Remaping Keys</a><br />
<a href="http://www.autohotkey.com/docs/Hotstrings.htm">HotStrings (auto expanding text, like my signature)</a><br />
Now, knowing all this, we can use AutoHotKey to map Control-Alt-Break to some other key. I use Control-Alt-C as my Control-Alt-Break replacement. Here is the code:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #33cc33;">^!</span>c::send <span style="color: #33cc33;">^!</span>{CtrlBreak}</pre></div></div>

<p>You can download the Control-Alt-Break file here:<br />
<a href='http://www.rodolforodarte.com/wp-content/uploads/2011/10/CtrlAltBreak.zip'>CtrlAltBreak.zip</a></p>
<p>All you have to do is save this to a file, load the file in AutoHotKey, and use Control-Alt-C whenever you need your Remote Desktop session back to full screen.</p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/21n86k_0vig" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2011/10/remote-desktop-won%e2%80%99t-go-back-to-full-screen-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2011/10/remote-desktop-won%e2%80%99t-go-back-to-full-screen-part-2/</feedburner:origLink></item>
		<item>
		<title>SQL Saturday 97 Slides and Code – EXCEPT, INTERSECT, APPLY</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/ucz2etCUHJM/</link>
		<comments>http://www.rodolforodarte.com/2011/10/sql-saturday-97-slides-and-code/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 20:02:03 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[APPLY]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[CTE]]></category>
		<category><![CDATA[EXCEPT]]></category>
		<category><![CDATA[INTERSECT]]></category>
		<category><![CDATA[SQL SATURDAY]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=7229</guid>
		<description><![CDATA[Download my slides and source code from my SQL Saturday 97 presentation.]]></description>
			<content:encoded><![CDATA[<p>I had the pleasure of speaking at <a href="http://www.sqlsaturday.com/97/eventhome.aspx">SQL Saturday 97</a>, right here, in Austin, TX this year. I gave a presentation over INTERSECT, EXCEPT, CROSS APPLY and OUTER APPLY. Here is a zip copy of the Power Point, The Power Point as a PDF, and the SSMS Project.</p>
<p>Download the zip file here: <a href="http://www.rodolforodarte.com/wp-content/uploads/2011/10/Intersect_Except.zip">INTERSECT_EXCEPT.ZIP</a><a href="http://www.rodolforodarte.com/wp-content/uploads/2011/10/Intersect_Except.zip"><img src="http://www.rodolforodarte.com/wp-content/uploads/2011/10/SQLSaturday97-300x223.png" alt="SQLSaturday97" title="SQLSaturday97" width="300" height="223" class="aligncenter size-medium wp-image-7230" /></a></p>
<p>If you have any questions, you can always <a href="http://www.rodolforodarte.com/about/">contact me</a>, or send me <a href="http://www.twitter.com/shadyrudy">tweet.</a></p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/ucz2etCUHJM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2011/10/sql-saturday-97-slides-and-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2011/10/sql-saturday-97-slides-and-code/</feedburner:origLink></item>
		<item>
		<title>Incorrect Syntax Near go revisited</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/1UPVIn1azlM/</link>
		<comments>http://www.rodolforodarte.com/2011/08/incorrect-syntax-near-go-revisited/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 20:01:50 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[sp_executesql]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=7223</guid>
		<description><![CDATA[Incorrect Syntax near go. We've all gotten this error before, but why does this happen? Watch a video explaining why you cannot use GO inside of sp_executesql]]></description>
			<content:encoded><![CDATA[<p>Working with sp_executeSQL? You&#8217;ve probably seen the <span style="color: #ff0000;">Incorrect Syntax Near Go</span> error at one time or another.<br />
I created a quick video showing what happens when you use <span style="color: #ff0000;">GO</span> inside of an sp_executesql statement:<br />
<iframe src="http://player.vimeo.com/video/28029978?title=0&amp;byline=0&amp;portrait=0" frameborder="0" width="400" height="300"></iframe></p>
<p><a href="http://vimeo.com/28029978">Incorrect Syntax Near go in SQL Server</a> from <a href="http://vimeo.com/shadyrudy">Rudy Rodarte</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>If you still have questions, please leave a comment and we can work through your particular issue.</p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/1UPVIn1azlM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2011/08/incorrect-syntax-near-go-revisited/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2011/08/incorrect-syntax-near-go-revisited/</feedburner:origLink></item>
		<item>
		<title>Find your SQL Server Profiler Template Path</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/D2R_JY3CSVg/</link>
		<comments>http://www.rodolforodarte.com/2011/08/sql-server-profiler-template-path/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 19:52:29 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Profiler]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Template]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=7215</guid>
		<description><![CDATA[Learn where SQL Server Profiler saves your Templates.]]></description>
			<content:encoded><![CDATA[<p>I was brushing up on some SQL Server Perfmon and Profiler stuff over on <a href="http://www.brentozar.com/archive/2006/12/dba-101-using-perfmon-for-sql-performance-tuning/">BrentOzar.com</a>. What I wanted to do was save the SQL Server Profiler template I created in my dropbox, so I could have access to it from all of my machines. The only problem is, I couldn&#8217;t find the template anywhere. Only after I did some digging, did I find the file here:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">C:\Users\YourUserName\AppData\Roaming\Microsoft\SQL Profiler\10.0\Templates\Microsoft SQL Server\100\</pre></div></div>

<p>The built in templates are found here:</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">C:\Program Files <span style="color: #33cc33;">(</span>x86<span style="color: #33cc33;">)</span>\Microsoft SQL Server\100\Tools\Profiler\Templates\Microsoft SQL Server\100\</pre></div></div>

<p>As always, the exact location(90,100,110, etc)  changes, depending on your version of SQL Server. But this should get you in the correct folder.</p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/D2R_JY3CSVg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2011/08/sql-server-profiler-template-path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2011/08/sql-server-profiler-template-path/</feedburner:origLink></item>
		<item>
		<title>Display a Page Count in SSRS</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/oEXcyoThr0o/</link>
		<comments>http://www.rodolforodarte.com/2011/08/display-a-page-count-in-ssrs/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 17:03:41 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=7199</guid>
		<description><![CDATA[Learn how to add a date printed and a page count in the footer of your SSRS report. Even if you have errors with Globals!OverallTotalPages. ]]></description>
			<content:encoded><![CDATA[<p>When creating <a href="http://msdn.microsoft.com/en-us/library/ms159106.aspx">SSRS</a> reports, it is great to add informational things in the footer. To create a footer, simply right click anywhere outside of the report body, and click on:<br />
<strong>Add Page Footer.</strong><br />
One item that I put in all of my SSRS reports is a Date Printed and a Page X of Y. Date printed is easy enough. You simply add a text box to the footer and use</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">=now()</pre></div></div>

<p>as the expression. Next format the text box as you like and you&#8217;re done.<br />
However, I hit a sang on the page x of y. SSRS was giving me an error with it&#8217;s built in field:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Globals!OverallTotalPages</pre></div></div>

<p>After a bit of searching, I found that you have to use</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">Globals!TotalPages</pre></div></div>

<p>instead of OverallTotalPages. Your text box expression will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;">=<span style="color: #800000;">&quot;Page &quot;</span> &amp; Globals!PageNumber &amp; <span style="color: #800000;">&quot; of &quot;</span> &amp; Globals!TotalPages</pre></div></div>

<p>Now, your SSRS page footer is complete!</p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/oEXcyoThr0o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2011/08/display-a-page-count-in-ssrs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2011/08/display-a-page-count-in-ssrs/</feedburner:origLink></item>
		<item>
		<title>Display results Horizontally in SQL Server</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/3d1T326rPl0/</link>
		<comments>http://www.rodolforodarte.com/2011/07/display-results-horizontally-in-sql-server/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 21:59:42 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[CTE]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=7172</guid>
		<description><![CDATA[Learn how to use SQL Server's CTEs to display results in a horizontal format instead of the standard vertical format. ]]></description>
			<content:encoded><![CDATA[<p>We are all familiar with seeing our data in a vertical format from SSMS. Here is a sample:</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #0000FF;">SELECT</span>  <span style="color: #808080;">*</span>
<span style="color: #0000FF;">FROM</span>    #EmployeeJobs
&nbsp;
Employee_ID	Job_id
<span style="color: #000;">100</span>	<span style="color: #000;">500</span>
<span style="color: #000;">100</span>	<span style="color: #000;">501</span>
<span style="color: #000;">100</span>	<span style="color: #000;">502</span>
<span style="color: #000;">100</span>	<span style="color: #000;">503</span>
<span style="color: #000;">100</span>	<span style="color: #000;">504</span>
<span style="color: #000;">191</span>	<span style="color: #000;">501</span>
<span style="color: #000;">191</span>	<span style="color: #000;">502</span>
<span style="color: #000;">191</span>	<span style="color: #000;">503</span>
<span style="color: #000;">191</span>	<span style="color: #000;">505</span>
<span style="color: #000;">188</span>	<span style="color: #000;">503</span>
<span style="color: #000;">188</span>	<span style="color: #000;">504</span></pre></div></div>

<p>But what if you, or your customer want&#8217;s the data horizontally? That is easy enough with a CTE. <span id="more-7172"></span>Here is a quick sample that creates a temp table with some employees and jobs.</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #008080;">--  Create a sample table</span>
<span style="color: #0000FF;">create</span> <span style="color: #0000FF;">table</span> #EmployeeJobs
<span style="color: #808080;">&#40;</span>     Employee_ID   <span style="color: #0000FF;">int</span>
    , Job_id        <span style="color: #0000FF;">int</span>
<span style="color: #808080;">&#41;</span>    
&nbsp;
<span style="color: #008080;">--  Insert some values into the table</span>
<span style="color: #0000FF;">insert</span> <span style="color: #0000FF;">into</span> #EmployeeJobs<span style="color: #808080;">&#40;</span> Employee_ID, Job_id <span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">values</span>
<span style="color: #808080;">&#40;</span><span style="color: #000;">100</span>,<span style="color: #000;">500</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">100</span>,<span style="color: #000;">501</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">100</span>,<span style="color: #000;">502</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">100</span>,<span style="color: #000;">503</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">100</span>,<span style="color: #000;">504</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">191</span>,<span style="color: #000;">501</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">191</span>,<span style="color: #000;">502</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">191</span>,<span style="color: #000;">503</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">191</span>,<span style="color: #000;">505</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">188</span>,<span style="color: #000;">503</span><span style="color: #808080;">&#41;</span>
,<span style="color: #808080;">&#40;</span><span style="color: #000;">188</span>,<span style="color: #000;">504</span><span style="color: #808080;">&#41;</span>
&nbsp;
<span style="color: #008080;">--  Use a CTE to build a list the employees and their jobs</span>
;with CTE <span style="color: #0000FF;">as</span>
<span style="color: #808080;">&#40;</span><span style="color: #0000FF;">SELECT</span>   Employee_ID
        , Job_id
        , row_number<span style="color: #808080;">&#40;</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">over</span> <span style="color: #808080;">&#40;</span>partition <span style="color: #0000FF;">by</span> Employee_ID <span style="color: #0000FF;">order</span> <span style="color: #0000FF;">by</span> Job_id<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">as</span> Numbers
<span style="color: #0000FF;">FROM</span>    #EmployeeJobs
<span style="color: #808080;">&#41;</span>
&nbsp;
<span style="color: #008080;">--  Display all of the user jobs</span>
<span style="color: #0000FF;">select</span>    EMPLOYEE_ID
        , <span style="color: #FF00FF;">max</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">case</span> <span style="color: #0000FF;">when</span> Numbers <span style="color: #808080;">=</span> <span style="color: #000;">1</span> <span style="color: #0000FF;">then</span> Job_id <span style="color: #0000FF;">else</span> null <span style="color: #0000FF;">end</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">as</span> Job_1
        , <span style="color: #FF00FF;">max</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">case</span> <span style="color: #0000FF;">when</span> Numbers <span style="color: #808080;">=</span> <span style="color: #000;">2</span> <span style="color: #0000FF;">then</span> Job_id <span style="color: #0000FF;">else</span> null <span style="color: #0000FF;">end</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">as</span> Job_2
        , <span style="color: #FF00FF;">max</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">case</span> <span style="color: #0000FF;">when</span> Numbers <span style="color: #808080;">=</span> <span style="color: #000;">3</span> <span style="color: #0000FF;">then</span> Job_id <span style="color: #0000FF;">else</span> null <span style="color: #0000FF;">end</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">as</span> Job_3
        , <span style="color: #FF00FF;">max</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">case</span> <span style="color: #0000FF;">when</span> Numbers <span style="color: #808080;">=</span> <span style="color: #000;">4</span> <span style="color: #0000FF;">then</span> Job_id <span style="color: #0000FF;">else</span> null <span style="color: #0000FF;">end</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">as</span> Job_4
        , <span style="color: #FF00FF;">max</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">case</span> <span style="color: #0000FF;">when</span> Numbers <span style="color: #808080;">=</span> <span style="color: #000;">5</span> <span style="color: #0000FF;">then</span> Job_id <span style="color: #0000FF;">else</span> null <span style="color: #0000FF;">end</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">as</span> Job_5
        , <span style="color: #FF00FF;">max</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">case</span> <span style="color: #0000FF;">when</span> Numbers <span style="color: #808080;">=</span> <span style="color: #000;">6</span> <span style="color: #0000FF;">then</span> Job_id <span style="color: #0000FF;">else</span> null <span style="color: #0000FF;">end</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">as</span> Job_6
<span style="color: #0000FF;">from</span>    CTE
<span style="color: #0000FF;">group</span> <span style="color: #0000FF;">by</span> EMPLOYEE_ID</pre></div></div>

<p>Now, the results will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">EMPLOYEE_ID	Job_1	Job_2	Job_3	Job_4	Job_5	Job_6
100	500	501	502	503	504	NULL
188	503	504	NULL	NULL	NULL	NULL
191	501	502	503	505	NULL	NULL</pre></div></div>

<p>This probably isn&#8217;t the best way to get results in this fashion, but it is certainly quick and easy. Thanks to the guys at <a href="http://www.sqlservercentral.com/Forums/Topic1128376-338-1.aspx#bm1128536">SQLServerCentral.com</a> for this one!</p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/3d1T326rPl0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2011/07/display-results-horizontally-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2011/07/display-results-horizontally-in-sql-server/</feedburner:origLink></item>
		<item>
		<title>Find numbers within a string in Excel</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/QXf6vc2ki1o/</link>
		<comments>http://www.rodolforodarte.com/2011/07/find-numbers-within-a-string-in-excel/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 21:15:42 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=6781</guid>
		<description><![CDATA[Learn how to use excel to extract numbers from strings.]]></description>
			<content:encoded><![CDATA[<p>Recently, I had to pull customer numbers out of strings from an excel sheet. Sure,  you can use trickery like spaces to columns or regex. Excel is pretty powerful, if you know all of the text tools at your disposal. This is how I extracted the numbers for random text</p>
<p><span id="more-6781"></span><br />
The problem was, each row was formatted differently. So I had several thousand rows that looked like this:</p>
<p>Client A (555)<br />
Client B (789) Houston<br />
Client Dallas (4444)</p>
<p>and so on.</p>
<p>I looked around on some <a href="http://www.excelforum.com/excel-worksheet-functions/630231-extract-number-from-alphanumeric-string.html">Excel Guru</a> sites and found the following formula.<br />
<code><br />
=REPLACE(LEFT(A1,LOOKUP(10,MID(A1,ROW(INDIRECT("1:30")),1)+0,ROW(INDIRECT("1:30")))),1,MIN(FIND(0,SUBSTITUTE(A1&#038;0,{1,2,3,4,5,6,7,8,9},0)))-1,"")+0<br />
</code></p>
<h3>Caveat</h3>
<p>Though not perfect, this was exactly what I needed. The one drawback to this code is any cell with non sequential numbers such as:<br />
Client T1000 Loop 360<br />
will not work.<br />
<img src="http://www.rodolforodarte.com/wp-content/uploads/2011/07/Excel_Numbers_In_Strings.png" alt="" title="Excel_Numbers_In_Strings" width="734" height="518" class="alignleft size-full wp-image-6783" /></p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/QXf6vc2ki1o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2011/07/find-numbers-within-a-string-in-excel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2011/07/find-numbers-within-a-string-in-excel/</feedburner:origLink></item>
		<item>
		<title>Working with Seconds in Excel</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/yKbtvxvLKvg/</link>
		<comments>http://www.rodolforodarte.com/2011/05/working-with-seconds-in-excel/#comments</comments>
		<pubDate>Tue, 24 May 2011 16:17:20 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=4599</guid>
		<description><![CDATA[I recently had to use back end data from SQL Server to deliver several reports in excel. All of my SQL code gave me results in seconds; however, the users had distinct formatting requests. I would have to use a few excel tricks to get things just right in each report.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.rodolforodarte.com/wp-content/uploads/2011/05/Seconds_to_Hours.png"><img class="size-full wp-image-4601 aligncenter" title="Seconds_to_Hours" src="http://www.rodolforodarte.com/wp-content/uploads/2011/05/Seconds_to_Hours.png" alt="" width="687" height="212" /></a></p>
<p>I recently had to use back end data from SQL Server to deliver several reports in excel. All of my SQL code gave me results in seconds; however, the users had distinct formatting requests. I would have to use a few excel tricks to get things just right in each report.<br />
<span id="more-4599"></span></p>
<h2>Time in Seconds to HH:MM:SS</h2>
<p>For the first request, I had to take the number of seconds and convert to HH:MM:SS. My script gave me results like 18000 seconds or so. To get the results in the desired format, I first divide the value by 86400. 86400 is the number of seconds in a day (60*60*24). Next, in custom formatting, choose <strong>[h]:mm:ss.</strong> It is important to choose [h]:mm:ss instead of HH:MM:SS because the h in brackets allows numbers greater than 23. So, our example of 18000 seconds becomes 5 hours.</p>
<h2>Time to Decimal Hours</h2>
<p>For the second request, I had to take the number of seconds and covert to decimal hours. Let’s look at 5 hours and 45 minutes or 20700 seconds. The first step is to divide the seconds by 86400 and convert the value to <strong>[h]:mm:ss</strong>. In our example, 20700 seconds appears as 5:45:00. Next, divide the value by 0.041666667. The number 0.041666667 = 1/24th of a day.  Lastly, format the results as number with 2 decimal places. The result comes out nicely with number of hours before the decimal and fractional hours after the decimal. So, our example of 20700 seconds becomes 5.75 hours.</p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/yKbtvxvLKvg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2011/05/working-with-seconds-in-excel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2011/05/working-with-seconds-in-excel/</feedburner:origLink></item>
		<item>
		<title>Using datediff to display results as HH:MM:SS</title>
		<link>http://feedproxy.google.com/~r/RudyRodarteCom/~3/8yGNzlSGLkA/</link>
		<comments>http://www.rodolforodarte.com/2011/05/using-datediff-to-display-hhmmss/#comments</comments>
		<pubDate>Thu, 05 May 2011 20:13:25 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.rodolforodarte.com/?p=3686</guid>
		<description><![CDATA[DateDiff is a great tool in SQL Server. But you have to extend DateDiff a bit to get things in a nicer format, such as HH:MM:SS. See what Rudy found on SQLServerCentral.com which saved the afternoon!]]></description>
			<content:encoded><![CDATA[<div id="attachment_3694" class="wp-caption alignnone" style="width: 543px"><img class="size-full wp-image-3694" title="DateDIff" src="http://www.rodolforodarte.com/wp-content/uploads/2011/05/DateDIff1.png" alt="" width="533" height="374" /><p class="wp-caption-text">DateDiff, y u no Pretty?</p></div>
<h1>Sometimes you just need hh:mm:ss</h1>
<p>I ran into a case when I needed to display some results in the HH:MM:SS format. We all know and love <a href="http://msdn.microsoft.com/en-us/library/ms189794.aspx">DATEDIFF</a>, which gives you whole number results. Using <span style="color: #ff00ff;">DATEDIFF</span>, I was getting results like this:</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #008080;">--	Declare some variables for the requested timeframe</span>
<span style="color: #0000FF;">DECLARE</span>	@START_DATE	<span style="color: #0000FF;">DATETIME</span>
<span style="color: #0000FF;">DECLARE</span>	@END_DATE	<span style="color: #0000FF;">DATETIME</span><span style="color: #008080;">--	Set the timeframe variables</span>
<span style="color: #0000FF;">SET</span>		@START_DATE <span style="color: #808080;">=</span> <span style="color: #FF0000;">'2011-01-01 16:00:00'</span>
<span style="color: #0000FF;">SET</span>		@END_DATE <span style="color: #808080;">=</span>   <span style="color: #FF0000;">'2011-01-01 22:47:22'</span><span style="color: #0000FF;">SELECT</span> <span style="color: #FF00FF;">DATEDIFF</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">second</span>,@Start_date, @END_DATE<span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> Segundos</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Segundos
24442
&nbsp;
(1 row(s) affected)</pre></div></div>

<p><span id="more-3686"></span><br />
The results are all well and good, but that isn&#8217;t something that I would want to hand over to the end users. So, I did a bit of hunting and found what I was looking for over on <a href="http://www.sqlservercentral.com/Forums/Topic676470-338-1.aspx">SQLServerCentral.com</a>. The guy wanted to display milliseconds along with the rest of his results. That was overkill so, his script worked perfectly for me. Here is what I ended using:</p>

<div class="wp_syntax"><div class="code"><pre class="tsql" style="font-family:monospace;"><span style="color: #008080;">--	Declare some variables for the requested timeframe</span>
<span style="color: #0000FF;">DECLARE</span>	@START_DATE	<span style="color: #0000FF;">DATETIME</span>
<span style="color: #0000FF;">DECLARE</span>	@END_DATE	<span style="color: #0000FF;">DATETIME</span><span style="color: #008080;">--	Set the timeframe variables</span>
<span style="color: #0000FF;">SET</span>		@START_DATE <span style="color: #808080;">=</span> <span style="color: #FF0000;">'2011-01-01 16:00:00'</span>
<span style="color: #0000FF;">SET</span>		@END_DATE <span style="color: #808080;">=</span>   <span style="color: #FF0000;">'2011-01-01 22:47:22'</span><span style="color: #008080;">--	Use datediff to show the results in the</span>
<span style="color: #008080;">--	HH:MM:SS format</span>
<span style="color: #0000FF;">SELECT</span>    <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">varchar</span><span style="color: #808080;">&#40;</span><span style="color: #000;">6</span><span style="color: #808080;">&#41;</span>, <span style="color: #FF00FF;">DATEDIFF</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">second</span>, @START_DATE, @END_DATE<span style="color: #808080;">&#41;</span><span style="color: #808080;">/</span><span style="color: #000;">3600</span><span style="color: #808080;">&#41;</span>
<span style="color: #808080;">+</span> <span style="color: #FF0000;">':'</span>
<span style="color: #808080;">+</span> <span style="color: #0000FF;">RIGHT</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'0'</span> <span style="color: #808080;">+</span> <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">varchar</span><span style="color: #808080;">&#40;</span><span style="color: #000;">2</span><span style="color: #808080;">&#41;</span>, <span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">DATEDIFF</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">second</span>, @START_DATE, @END_DATE<span style="color: #808080;">&#41;</span> <span style="color: #808080;">%</span> <span style="color: #000;">3600</span><span style="color: #808080;">&#41;</span> <span style="color: #808080;">/</span> <span style="color: #000;">60</span><span style="color: #808080;">&#41;</span>, <span style="color: #000;">2</span><span style="color: #808080;">&#41;</span>
<span style="color: #808080;">+</span> <span style="color: #FF0000;">':'</span>
<span style="color: #808080;">+</span> <span style="color: #0000FF;">RIGHT</span><span style="color: #808080;">&#40;</span><span style="color: #FF0000;">'0'</span> <span style="color: #808080;">+</span> <span style="color: #0000FF;">CONVERT</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">varchar</span><span style="color: #808080;">&#40;</span><span style="color: #000;">2</span><span style="color: #808080;">&#41;</span>, <span style="color: #FF00FF;">DATEDIFF</span><span style="color: #808080;">&#40;</span><span style="color: #0000FF;">second</span>, @START_DATE, @END_DATE<span style="color: #808080;">&#41;</span> <span style="color: #808080;">%</span> <span style="color: #000;">60</span><span style="color: #808080;">&#41;</span>, <span style="color: #000;">2</span><span style="color: #808080;">&#41;</span> <span style="color: #0000FF;">AS</span> <span style="color: #FF0000;">'HH:MM:SS'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">HH:MM:SS
6:47:22</pre></div></div>

<p>The results come back in a nicer, easily readable format.</p>
<img src="http://feeds.feedburner.com/~r/RudyRodarteCom/~4/8yGNzlSGLkA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.rodolforodarte.com/2011/05/using-datediff-to-display-hhmmss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.rodolforodarte.com/2011/05/using-datediff-to-display-hhmmss/</feedburner:origLink></item>
	</channel>
</rss>

