Encrypted Store Procedures and Their Effect on my Rug

This is a letter, or a rant, to any ISVs in the world who encrypt their stored procedures. It is, by no means, a condemnation of this horrible feature of SQL Server. The feature condemns itself. I saw something in a blog the other day (that I wish I could find it again) where the author essentially said that encrypting stored procedures is an absolute necessity. I couldn’t help but incredulously think “Really?

Speaking is so done

[caption id=“attachment_1437” align=“alignright” width=“150”] Take three steps to your right to advance to the next slide[/caption] Honestly, I’m tired of speaking. PowerPoint is overrated. People want more or less bullet points. It’s never enough. More graphs. More pie charts. Less funny images. More dinosaurs. Stop showing pictures of Zeus sexing up a goat. I don’t know what you people want!Demos – you can shove those, too. People complain when the code doesn’t fit on the screen or when my resolution is too low or when they have some kind of vitamin deficiency and they can’t look at the color #0f0015 for more than 32 seconds without suffering from a migraine.

Pay Attention

[caption id=“attachment_1397” align=“alignright” width=“200”]Are we not men? No, we are Hammurabi![/caption] What are you doing right now? How many different things are you trying to balance? Stop all of them and pay attention. No, seriously, do it. Nobody is going to die in the next five minutes. Unless you’re in surgery or something. In which case go do your job. I’m here reminding you that you need to pay attention. This isn’t like in Middle School history when you were learning about the Epic of Gilgamesh and how he killed a demi-god with the help of a hairy little man and together they survive watching the movie Ishtar and end up wearing a cow’s ass as a hat or something.

T-SQL Tuesday 4: Io, Io, it’s off to disk we go

[caption id=“attachment_1407” align=“alignright” width=“145”]Fact: the earliest recorded use of cloud computing was ancient Greek porn.[/caption] Io was a nymph. True story. Apparently, her father was some kind of river god. In modern times that means you’re likely to catch fire. Back in the days when the Greeks were in charge of things being a river god meant that you were somebody (the Greeks thought the earth was a giant brass plate floating a huge river, all of which was created by perverts who lived on top of a mountain).

My MacGyver Moment

David Stein started this current blog meme. He passed the buck on to Brent Ozar, who shared a horrifying tale of his time in the trenches as a developer. Brent then thoughtfully pointed at me and demanded that I carry on the blog meme torch. Blog memes are great. They give me an opportunity to pretend to be inventive and creative, take someone else’s great idea and spin it in a centrifuge to extract the good stuff and then pass the detritus along to someone else to deal with.

Rounding to the Nearest X Minutes, the Lazy Way

A lot of people use calendar tables. I’ve blogged about it before. They’re incredibly helpful. Now, have you ever needed a table of minutes? You’re probably asking, “Jeremiah, why the heck would I ever need a table of minutes?” Well, dear reader, I’m going to tell you that. Please stop interrupting. Let’s say you have a report. This report shows the sum of sales per 5 minute increment. You could do a lot of trickery with math to make this report happen, doing things like this to get the 5 minute interval:``` SELECT (DATEPART(mi, CAST(‘2009-01-01 00:01:00’ as datetime))+4) / 5 * 5 AS [05]

A Simple Refactoring – Functions in the WHERE Clause

Putting functions in the where clause of a SQL Statement can cause performance problems. If you aren’t careful, these problems can add up and bring a powerful production system to its knees. For this example, I’m using the Northwind database, but you could do this on any database. The first thing to do is put an index on the OrderDate column:CREATE INDEX IX\_Orders\_OrderDate ON dbo.Orders (OrderDate) ;Take a look at this first query:SELECT COUNT(\*) FROM dbo.

Installing PostgreSQL on Mac OS X

This is a pretty simple process, but one that I thought I would document because I ran into a few gotchas along the way. I originally installed OS X using the one click installer from EnterpriseDB. Unfortunately, the installer hung while attempting to finish the installation process and they only thing to do was to roll back the install. I attempted to build from macports, but that proved to be a huge pain in my ass and reminded me a little bit too much of using Linux, so I scrapped that idea as well.

Links for the Week - 2010.02.12

This is more of a “what I’ve been reading” rather than a link dump from previous week’s RSS feed. A Plea for Plain English – Tony Davis’s “A Plea for Plain English” rings home with me. Far too much writing is full of heavy, pompous words used purely to make the author feel smarter. Joseph Conrad – one of the greatest writers of the English language – was not a native speaker.

A Simple Refactoring – Avoiding Table Scans

Refactoring SQL code can be pretty easy. Just like refactoring any other programming language, sometimes you have to look around to find the culprit. We have a slow running query that frequently times out when run by the users. A quick look at the query told me what was wrong. I found this clause in the middle of an otherwise simple query:``` LEFT JOIN ( SELECT DISTINCT key, column_a FROM ImportantData WHERE FieldName = ‘VALUES’ UNION ALL SELECT DISTINCT key, column_a FROM ImportantData_History WHERE FieldName = ‘VALUES’ ) AS t ON other.