Archive for the ‘SQL’ Category

#TSQL2sDay 001: Date/Time Issues and Data Modeling

This is my first post for T-SQL Tuesday (thanks, Adam, for the idea!); I’m hoping this will be a continuing block party, and hopefully connect a lot of us SQL bloggers together.  There’s a lot of great content out there, and sometimes it’s just tough to find. Just a few notes before I get started [...]

December 8, 2009 · stuart · One Comment
Posted in: TSQL2sDay

Good Habits To Adopt: Enforcing the natural primary key

I’ve been reading Aaron Bertrand’s great series of blog posts on bad habits to kick, and have been thinking to myself: what are some good habits that SQL Server developers should implement?    I spend most of my day griping about bad design from vendors, yet I hardly ever take the time to document what should [...]

October 22, 2009 · stuart · 3 Comments
Posted in: Good Habits, SQL, SQLServerPedia Syndication

<facedesk>

So, I’ve been answering questions on StackOverflow for two days now, and I still like the experience.  However, I have noticed a disturbing trend in several of the questions being asked that involve SQL Server.  Here’s an example of one; I’ll give you the question, and my answer, and then tell you what’s bugging me. [...]

October 8, 2009 · stuart · 3 Comments
Posted in: SQL, SQLServerPedia Syndication

Building ranges using numbers

A while back, I posted a solution to a problem I was facing where I needed to generate a table of ranges.  While I haven’t experienced any sort of issues with the solution, a couple of things have recently occurred which has caused me to go back and take a look at the problem, and [...]

September 27, 2009 · stuart · 3 Comments
Posted in: SQL, SQL Server, SQLServerPedia Syndication

FizzBuzz

Stumbled across Mike Hillwig’s post in response to a question posed by Brent Ozar.  Depending on how literally you want to use the word “print” (do you mean the actual command, or do you just want output?), I think I have a slightly more elegant solution than what Mike proposed. SELECT CASE WHEN n%3=0 AND [...]

September 27, 2009 · stuart · No Comments
Posted in: SQL, SQL Server, SQLServerPedia Syndication

Fun with NEWSEQUENTIALID()

We’re thinking about converting the constrain on an existing column in a table with billions of rows of data.  The column is a uniqueidentifier serving as a nonclustered primary key; we’re planning on replacing the NEWID() constraint to a NEWSEQUENTIALID().  What is challenging me is my concern over primary key collisions; will the new default [...]

July 31, 2009 · stuart · One Comment
Posted in: SQL, SQL Server, SQLServerPedia Syndication

You CAN teach an old dog….

This is more of a sticky note kind of post, to remind me to use a better syntax in the future.  Maybe it’ll help some of you as well.  A long time ago, when I was starting to write T-SQL, and I needed to extract only the date from a DATETIME column, I used to [...]

July 24, 2009 · stuart · One Comment
Posted in: SQL, SQLServerPedia Syndication

Partitioning computed columns

For a project at work, I’ve been asked to help optimize our ETL process.  Part of that involves taking an existing table, and partitioning it along two existing columns.  Since the partitioning process only supports partitioning on one column, the obvious choice is to use a computed column.  I ran into some issues along the [...]

July 22, 2009 · stuart · No Comments
Posted in: SQL, SQL Server, SQLServerPedia Syndication

SCRUM, Source Control, and the SQL Server Developer (Part 2)

So my last post focused on the modifications my shop has made to our implementation of Scrum without a lot of details about how we manage our code changes.  This post is intended to explain how we set up source control to support the scrum process. Source control is one of those poorly-defined practices; it’s [...]

May 20, 2009 · stuart · No Comments
Posted in: SQL, SQL Server, SQLServerPedia Syndication, VSTS:DB

SQLSaturday #7: Birmingham, AL May 30, 2009

I’ve been so busy with all of my other projects at work that I’ve forgotten to really tout this.  On May 30, I’ll be presenting at the Birmingham SQLSaturday (hosted by the Steel City SQL User Group).  My talk is titled “Confessions of a Data integrator”, and will focus on dealing with other people’s database [...]

May 17, 2009 · stuart · No Comments
Posted in: Conferences, SQL