Category: Applied SQL

Slash star, dash dash: Be obsessive about comments

I’m working on a new session* that I’ve named “T-SQL’s Hidden Support Feature”. It’s about comments. I’ll get to the reasons why I’m writing and presenting an hour long session on /* */ and — a bit later, but first: Why am I calling comments a “hidden support feature”? Comments themselves aren’t hidden; it’s the […]

“Thing IS NOT NULL” isn’t the same as “Thing != NULL”

I’ve talked about NULLs before. (Ref: Here’s a bit on ISNULL(), and here’s one about understanding NULL at a basic level.)  And yet, it’s worthwhile to bring these things up from time to time. “[Thing] != NULL” is nonsense. It won’t work the way you want it to work, because NULL literally means “unknown”. Nothing in the […]

Create a clustered index and a primary key on existing tables

It’s the simple things in life that can trip people up. I find that creating primary keys and clustered indexes on existing tables is one that newish DBAs tend to trip up on, and so (like I do), I shall blog about it so there’s a nice, clear, explicit reference available. Yes, Virginia, you most […]