<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel>
<title>Coder&apos;s Revolution - SQL</title>
<link>http://www.codersrevolution.com/index.cfm</link>
<description>Following RIA&apos;s, Adobe products, and coding in general.</description>
<language>en-us</language>
<pubDate>Mon, 20 May 2013 02:30:43 -0500</pubDate>
<lastBuildDate>Tue, 27 Oct 2009 22:54:00 -0500</lastBuildDate>
<generator>BlogCFC</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<managingEditor>brad@codersrevolution.com</managingEditor>
<webMaster>brad@codersrevolution.com</webMaster>
<itunes:subtitle></itunes:subtitle>
<itunes:summary></itunes:summary>
<itunes:category text="Technology" />
<itunes:category text="Technology">
<itunes:category text="Podcasting" />
</itunes:category>
<itunes:category text="Technology">
<itunes:category text="Tech News" />
</itunes:category>
<itunes:keywords></itunes:keywords>
<itunes:author></itunes:author>
<itunes:owner>
<itunes:email>brad@codersrevolution.com</itunes:email>
<itunes:name></itunes:name>
</itunes:owner>
<itunes:explicit>no</itunes:explicit>
<item>
<title>MS SQL Server Table Variable And Nested Select Gotcha (Bug?)</title>
<link>http://www.codersrevolution.com/index.cfm/2009/10/27/MS-SQL-Server-Table-Variable-And-Nested-Select-Gotcha-Bug</link>
<description>
My coworker found this interesting little SQL Server behavior today that was quite startling at first glance. It&apos;s like punching 2 + 2 into your calculator and having the result come back as 5. After pin-pointing the cause for the behavior, it ALMOST makes sense... except for the fact that it doesn&apos;t make sense at all. It involves a randomized sub-select and table variables.
[More]
</description>
<category>SQL</category>
<category>Performance</category>
<pubDate>Tue, 27 Oct 2009 22:54:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/10/27/MS-SQL-Server-Table-Variable-And-Nested-Select-Gotcha-Bug</guid>
</item>
<item>
<title>Sequoia Voting System Witch Hunt, err... Study Project</title>
<link>http://www.codersrevolution.com/index.cfm/2009/10/21/Sequoia-Voting-System-Witch-Hunt-err-Study-Project</link>
<description>
&lt;a href=&quot;http://mpwoodward.posterous.com&quot; target=&quot;_new&quot;&gt;Matt Woodward&lt;/a&gt; &lt;a href=&quot;http://mpwoodward.posterous.com/sequoia-voting-systems-source-code-released&quot; target=&quot;_new&quot;&gt;pointed out&lt;/a&gt; this &lt;a href=&quot;http://politics.slashdot.org/story/09/10/20/2254210/Sequoia-Voting-Systems-Source-Code-Released?from=rss&quot; target=&quot;_new&quot;&gt;Slash Dot article&lt;/a&gt; today about the accidental release of code from the &lt;a href=&quot;http://www.sequoiavote.com/&quot; target=&quot;_new&quot;&gt;Sequoia Voting Systems&lt;/a&gt; and a &lt;a href=&quot;http://studysequoia.wikispaces.com/&quot; target=&quot;_new&quot;&gt;web site&lt;/a&gt; dedicated to studying that code.
Apparently the Election Defense Alliance obtained a copy of the election data for Riverside County, California. It came in the form of a Microsoft SQL Server backup that was SUPPOSED to have all the code such as stored procs and triggers redacted. I wandered over to the &quot;Sequoia Voting System Study Project&quot; and scored me a copy of the data.
[More]
</description>
<category>SQL</category>
<category>Security</category>
<pubDate>Wed, 21 Oct 2009 01:15:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/10/21/Sequoia-Voting-System-Witch-Hunt-err-Study-Project</guid>
</item>
<item>
<title>How To Get The SQL Server SPID Out Of SeeFusion</title>
<link>http://www.codersrevolution.com/index.cfm/2009/9/21/How-To-Get-The-SQL-Server-SPID-Out-Of-SeeFusion</link>
<description>
I&apos;ve never kept too quiet about my affection for SeeFusion as a ColdFusion monitoring tool. I use it for debugging, performance monitoring, and basic metrics gathering. Here&apos;s an old note on the JDBC URL wrappers that I found myself digging up last week. I don&apos;t even think you can find this nugget on the official &lt;a href=&quot;http://www.seefusion.com&quot; target=&quot;_new&quot;&gt;SeeFusion&lt;/a&gt; site.
[More]
</description>
<category>SeeFusion</category>
<category>Server Administration</category>
<category>SQL</category>
<category>ColdFusion</category>
<category>Performance</category>
<pubDate>Mon, 21 Sep 2009 22:19:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/9/21/How-To-Get-The-SQL-Server-SPID-Out-Of-SeeFusion</guid>
</item>
<item>
<title>Phone Plan Matchup: SQL Brute Force Method</title>
<link>http://www.codersrevolution.com/index.cfm/2009/9/7/Phone-Plan-Matchup-SQL-Brute-Force-Method</link>
<description>
A few days ago on &lt;a href=&quot;http://www.houseoffusion.com/groups/cf-talk/&quot; target=&quot;_new&quot;&gt;CF-Talk&lt;/a&gt; &lt;a href=&quot;http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:60039&quot; target=&quot;_new&quot;&gt;Greg Morphis asked&lt;/a&gt; for a method to find the cheapest combination of phone plans that satisfy a customer&apos;s requirements for the number of lines being used and the amount of minutes to share between the plans. At first, I thought the answer could be derived directly, but since the plans and their relative price/minute values are essentially random, they create different price breaks that change as you add minutes and lines. This means one combination of plans might be the cheapest for 500 minutes, but once you increase that to 600 minutes, a completely different set of plans might come into play that are now the cheapest.
[More]
</description>
<category>SQL</category>
<pubDate>Mon, 07 Sep 2009 10:54:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/9/7/Phone-Plan-Matchup-SQL-Brute-Force-Method</guid>
</item>
<item>
<title>SQL Server 2000 NULL Bug When Left Outer Joining A Nested View</title>
<link>http://www.codersrevolution.com/index.cfm/2009/8/21/SQL-Server-2000-NULL-Bug-When-Left--Outer-Joining-A-Nested-View</link>
<description>
I found a very interesting behavior today with SQL Server 2000 SP4 that I&apos;m most certain is a bug. I Googled for a while and found a &lt;a href=&quot;http://groups.google.com/group/microsoft.public.sqlserver.programming/browse_frm/thread/6a651f74585474bd&quot; target=&quot;_new&quot;&gt;couple&lt;/a&gt; old &lt;a href=&quot;http://www.eggheadcafe.com/forumarchives/SQLServerserver/Aug2005/post23633283.asp&quot; target=&quot;_new&quot;&gt;threads&lt;/a&gt; bringing up similar issues but they were without confirmation nor resolution. My actual use case was fairly complicated and confusing. I thought long and hard and came up with a simple example of the problem that still made a shred of sense.
[More]
</description>
<category>SQL</category>
<pubDate>Fri, 21 Aug 2009 01:37:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/8/21/SQL-Server-2000-NULL-Bug-When-Left--Outer-Joining-A-Nested-View</guid>
<enclosure url="http://www.codersrevolution.com/enclosures/left_outer_join_bug.sql" length="1241" type="application/octet-stream"/>
</item>
<item>
<title>Bit By ANSI_NULLS- Are Your Nulls Antsy Too?</title>
<link>http://www.codersrevolution.com/index.cfm/2009/8/5/Bit-By-ANSINULLS--Are-Your-Nulls-Antsy-Too</link>
<description>
I had one of those (all-too common) moments today that I spent scratching my head at a page of SQL code that was failing for no apparent reason. What&apos;s worse is the EXACT same code worked in another window. After a good deal of poking and prodding I figured out what was wrong and it involved my ANSI_NULLS setting
[More]
</description>
<category>SQL</category>
<pubDate>Wed, 05 Aug 2009 00:39:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/8/5/Bit-By-ANSINULLS--Are-Your-Nulls-Antsy-Too</guid>
</item>
<item>
<title>SQL Server Temp Tables: When Do I Create My Indexes?</title>
<link>http://www.codersrevolution.com/index.cfm/2009/5/13/SQL-Server-Temp-Tables--When-Do-I-Create-My-Indexes</link>
<description>
My &lt;a href=&quot;http://www.codersrevolution.com/index.cfm/2009/5/3/SQL-Temp-Tables-and-Indexes&quot; target=_new&quot;&gt;last blog post&lt;/a&gt; was originally the start of this one, but I got so carried away talking about the different types of temp tables I split it off. Today&apos;s topic is when to create indexes on SQL temp tables-- before or after you add the data. &lt;a href=&quot;http://stackoverflow.com/questions/28877/why-does-sql-server-work-faster-when-you-index-a-table-after-filling-it&quot; target=&quot;_new&quot;&gt;Many people&lt;/a&gt; out there seem to hold the same opinion on the subject. I don&apos;t like taking other people&apos;s word and I also like doing things the hard way. Therefore I created a series of tests to see which way really was fastest.
[More]
</description>
<category>SQL</category>
<category>Performance</category>
<pubDate>Wed, 13 May 2009 00:31:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/5/13/SQL-Server-Temp-Tables--When-Do-I-Create-My-Indexes</guid>
</item>
<item>
<title>SQL Temp Tables</title>
<link>http://www.codersrevolution.com/index.cfm/2009/5/3/SQL-Temp-Tables-and-Indexes</link>
<description>
Here&apos;s a quick note about SQL temp tables. In SQL Server, there are three kinds of temporary tables you can use. The first kind (my favorite) are known as table variables. They only exist in memory and are not written to disk (unless your OS is low on RAM and starts swapping). Table variable names start with an &quot;@&quot; just like other T-SQL variables and the syntax for one is like so:
[More]
</description>
<category>SQL</category>
<category>Performance</category>
<pubDate>Sun, 03 May 2009 00:05:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/5/3/SQL-Temp-Tables-and-Indexes</guid>
</item>
<item>
<title>SQL Server: Extracting JUST Time From Datetime Value</title>
<link>http://www.codersrevolution.com/index.cfm/2009/3/26/SQL-Server-Extracting-JUST-Time-From-Datetime-Value</link>
<description>
Tonight I found myself needing to extract just the time from a datetime column in SQL Server 2000. After a bit of Googling, it became clear that there are about 1 million articles on how to extract just the date from a datetime, but not very many articles taking about just getting time. For reference, this is how I ended up doing it.
[More]
</description>
<category>SQL</category>
<pubDate>Thu, 26 Mar 2009 01:18:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/3/26/SQL-Server-Extracting-JUST-Time-From-Datetime-Value</guid>
</item>
<item>
<title>SQL Server DTS: I Love It When A Plan Comes Together... Then Falls Apart Again.</title>
<link>http://www.codersrevolution.com/index.cfm/2009/3/22/SQL-Server-DTS-I-Love-It-When-A-Plan-Comes-Together-Then-Falls-Apart-Again</link>
<description>
At work, we are building some content management utilities to keep track of our training materials and document all of our content in a database. To get a head start, our marketing team started a large Excel spreadsheet to list, categorize, label, and tag our hundreds and hundreds of resources. We decided to attempt to automatically import some of the content directly from Excel to keep them from having to hand-enter it again. Seeing as how we are wandering around in the cold, dark, stone ages of SQL Server 2000 I thought I would throw the .XLS file at a DTS package and see what happened.
[More]
</description>
<category>SQL</category>
<pubDate>Sun, 22 Mar 2009 21:52:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/3/22/SQL-Server-DTS-I-Love-It-When-A-Plan-Comes-Together-Then-Falls-Apart-Again</guid>
</item>
<item>
<title>SQL Server Performance: How Are My Indexes Being Using?</title>
<link>http://www.codersrevolution.com/index.cfm/2009/2/14/SQL-Server-Performance-How-Are-My-Indexes-Being-Using</link>
<description>
You may have a full-time DBA where you work, but a lot of us share the CF developer and DB developer hats. Your SQL Server&apos;s performance can be an easy thing to overlook if your database is very small, or your website gets very little traffic. The easy (but not always correct) answer to most performance problems is &quot;add an index&quot;. Some indexes are an obvious help, but how do you tell if the less obvious ones are really being used? It is possible to have too many indexes. In addition to bloating the size of your database, they take time to update which can actually slow your application DOWN on inserts and updates.
[More]
</description>
<category>SQL</category>
<category>Performance</category>
<pubDate>Sat, 14 Feb 2009 12:42:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/2/14/SQL-Server-Performance-How-Are-My-Indexes-Being-Using</guid>
</item>
<item>
<title>SQL Server Gotcha: Implicit Unicode Conversion</title>
<link>http://www.codersrevolution.com/index.cfm/2009/2/13/SQL-Server-Gotcha-Implicit-Unicode-Conversion</link>
<description>
A &lt;a href=&quot;http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:58726#319279&quot; target=&quot;_new&quot;&gt;recent thread&lt;/a&gt; on CF-Talk brought up this very good topic. It deals with the performance hit you can get when SQL Server implicitly converts your data to nchar and nvarchar for you when you have enabled Unicode support in your data sources. Unicode text cannot be stored in normal char or varchar fields. It must use nchar or nvarchar. These data types use two bytes per character, which means you can only store half as much text in them (limit 4,400 instead of 8,800). The problem is two fold:
&lt;ol&gt;
&lt;li&gt;SQL Server cannot directly compare a varchar and nvarchar value so it must convert one.&lt;/li&gt;
&lt;li&gt;String manipulation or conversion on an indexed column will render the index useless&lt;/li&gt;
&lt;/ol&gt;
[More]
</description>
<category>SQL</category>
<category>ColdFusion</category>
<category>Performance</category>
<pubDate>Fri, 13 Feb 2009 22:54:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2009/2/13/SQL-Server-Gotcha-Implicit-Unicode-Conversion</guid>
</item>
<item>
<title>SQL Server: How Many Work/Week Days In Date Range</title>
<link>http://www.codersrevolution.com/index.cfm/2008/10/15/SQL-Server-How-Many-WorkWeek-Days-In-Date-Range</link>
<description>
I had the need to calculate how many week days existed in an arbitrary range of dates today. I Googled for a while but didn&apos;t find anything I liked and I really didn&apos;t want to iterate over the entire range and count. For what it&apos;s worth, this is what I hacked out.
[More]
</description>
<category>SQL</category>
<category>General</category>
<pubDate>Wed, 15 Oct 2008 04:19:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2008/10/15/SQL-Server-How-Many-WorkWeek-Days-In-Date-Range</guid>
</item>
<item>
<title>MSSQL&apos;s openquery Saved Me</title>
<link>http://www.codersrevolution.com/index.cfm/2008/10/4/MSSQLs-openquery-Saved-Me</link>
<description>
Sorry I&apos;ve been quiet for the past few days. My Flex adventures took a quick detour through the massive land of our AS400 and DB2. Now that I had a prototype of my pretty line, bar, and pie charts I needed some real data. My job was to write a process to fetch our sales data from the AS400 server here at work nightly and populate some SQL Server tables with it. Easy Peasy, I thought. I didn&apos;t know what I was in for.
[More]
</description>
<category>SQL</category>
<category>AS400</category>
<category>Performance</category>
<pubDate>Sat, 04 Oct 2008 04:34:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2008/10/4/MSSQLs-openquery-Saved-Me</guid>
</item>
<item>
<title>SQL Date Parsing Error</title>
<link>http://www.codersrevolution.com/index.cfm/2008/9/30/SQL-Date-Parsing-Error</link>
<description>
I am writing some SQL to pull data from our AS400 here at work. I was getting the error &quot;Arithmetic overflow error converting expression to data type datetime.&quot; from the following code where date_column contained a date formatted like 20080930:
&lt;code&gt;year(date_column)&lt;/code&gt;
At first, I thought there was some bad data in the column. It turns out, the datatype was int as opposed to varchar like I had assumed. This fixed it:
&lt;code&gt;year(cast(date_column as varchar(8)))&lt;/code&gt;
</description>
<category>SQL</category>
<pubDate>Tue, 30 Sep 2008 16:38:00 -0500</pubDate>
<guid>http://www.codersrevolution.com/index.cfm/2008/9/30/SQL-Date-Parsing-Error</guid>
</item>
</channel></rss>