Latest Posts
June 16, 2021 · Matthew
This is pretty obscure, but did you know you can backup your databases to nul? Well you can, just like this: This performs a backup just like if you were backing up to a file location, it just doesn’t actually backup data anywhere. Many of the same parameters can even be enabled such as backup […]
No Comments »
April 22, 2021 · Matthew
I wanted to share a technique I use when writing scripts that include ad-hoc SQL statements. I think this technique makes the script cleaner and also easier to edit. First of all a warning. I don’t recommend using ad-hoc SQL for anything that will be executed by end-users or application code. Ad-hoc SQL queries usually […]
No Comments »
August 26, 2020 · Matthew
Another way to use CROSS APPLY is to unpivot a table. Unpivoting a table converts columns into rows. An example is turning a column-set into an attribute list such as taking this: HairColor ShirtColor PantsColor JacketColor ShoeColor Blonde Blue Tan Black Brown And turning it into this: Attribute Color HairColor Blonde ShirtColor Blue PantsColor Tan […]
No Comments »
August 23, 2019 · Matthew
This is my second blog post in as many days where I talk about my love for CROSS APPLY. In this post I will talk about how to simulate a lambda expression using CROSS APPLY. Lambda expressions, also known as anonymous, literal, or inline functions, are a way of describing a function that has no […]
No Comments »
August 23, 2019 · Matthew
As anyone who has ever worked with me will attest, I love using CROSS APPLY; it’s by far my favorite feature of the SQL language. When used carefully, it can even be more efficient than more traditional methods for aggregating data. This post demonstrates two use-cases where CROSS APPLY is more efficient. Sample Case For […]
No Comments »
August 3, 2019 · Matthew
This guide contains useful guidelines that I follow when designing and managing databases. Although many of the examples are in T-SQL, I have tried to generalize the rules as much as possible so that they can apply to other platforms. At some point I will probably split this guide into platform-specific sections for rules that […]
No Comments »
March 11, 2019 · Matthew
This is my first post in a long while. Recently, I have some more free time, so I’ll try to post more frequently. For this post, I will solve a variation of a problem that that I have encountered many times. Requirements Write a T-SQL function that takes a date input and returns the most […]
No Comments »
March 1, 2019 · Matthew
I started OC Computer Geek as a side business for doing general computer repair work. With the demands of full time job and having a family I was never able to fully commit to that project so I parked the domain for the last few years now. Since I find myself in the jobs market […]
No Comments »
August 13, 2013 · Matthew
I have been playing Luigi’s Mansion: Dark Moon for the last several weeks, and have been enjoying it immensely; until last night. In general, the missions are fun and challenging, and the game play itself is really kind of silly which adds to the fun factor. But there is one boss level which nearly sucked […]
No Comments »
July 24, 2013 · Matthew
It was time to put my wife’s old smartphone out to pasture. Her old Droid 2, itself a year old hand-me-down, had seen better days. In its day, it was the workhorse phone and the best in its breed, but now it seems to have lost a few steps in its old age. So what […]
No Comments »