I was recently asked to do some fairly heavy modifications to a table. It involved adding 6 new columns, removing 4 old ones, renaming 4 and then altering the datatype for those 4. I find these kinds of requests rather entertaining in a simplistic sort of way. I try to… Read more
This month for T-SQL Tuesday Mike Donnelly (b/t) decided to pick a topic to fit in with Ed Leighton-Dick’s (b/t) #SQLNewBlogger challenge. His highly open ended topic is to learn something new and blog about it. A great topic for a… Read more
I’m by no means an expert in SQL Server encryption. What I do know however, is that the Service Master Key is the top of the encryption chain on an instance. This means that any certificate or key will be encrypted using, in part, the Service Master Key. So if… Read more
CTEs (Common Table Expressions) are one of the most interesting and useful tools added to T-SQL in the last decade. But even though they have been around for that decade and are widely used I still find that they confuse people somewhat. Among other things this confusion leads… Read more
It seems that Microsoft has finally gotten tired of all the jokes about the word “performant” or using “ask” as a noun. Microsoft has decided to put it’s money where it’s mouth is and has announced today that they have purchased both Websters and Dictionary.com. Now why would they do… Read more
I made a mistake the other day. I’ll admit it. I was wrong. Now I know all of you are shocked, but it does happen on rare occasions. So what was I wrong about you might ask? One of the dev groups I support has been referring to their instances… Read more
I have a customer who is having a problem with a load. He is getting a fair number of bad characters including some unicode characters. The unicode characters in particular are making it so those values won’t go into a varchar column. This isn’t an uncommon problem so when he… Read more
Recently the last day to submit a session for the 2015 Pass Summit rolled around. I mention this because I actually submitted a session. This is the first time I’ve ever submitted something for the summit and only the third time I’ve submitted a session anywhere. And no, in neither… Read more
Most senior DBAs I’ve met shudder when they hear NOLOCK. Ever wonder why? For the same reason they shudder at shrink, MAXDOP of 1 and even occasionally at UDFs (user defined functions). Because frequently we see cargo cults develop around these technologies. Cases where a group of IT professionals (developers… Read more
Temporary tables are a common enough thing in T-SQL that most of us have probably used them on a fairly regular basis. What I don’t think a lot of people know is that there are two types of temporary tables.
- Local Temporary Tables
SELECT * INTO #LocalTempTable FROM sys.databases
There are a handful of scripts I use on a regular basis. Adam Mechanic’s (b/t) sp_WhoIsActive, My sp_DBPermissions and sp_SrvPermissions, my script for finding where backups are taken, Paul Brewer’s sp_RestoreGene to name a few. It gets tiresome at best to constantly be looking… Read more
A common problem when trying to alter a database (take it offline, add a filegroup, whatever) is that someone else is in the database and you need to find them and kick them out before you can proceed. Historically I would use sp_who and scroll down the list looking for… Read more
I don’t know how to get started.
Pretty simple. There are a number of free blogging sites out there. Personally I use WordPress. All you need to do is go to http://www.wordpress.com and sign up for a free space.
I have a blog but setting it up seems like a…
Every month SQL Judo (Russ Thomas) (b/t) challenges us to do his Monthly DBA Challenge. I’ve decided it would be fun (and good practice) to do them. Another major benefit is that it will force me to move out of my normal comfort zone. For… Read more
It’s been a while since I posted an updated to usp_DBPermissions and usp_SrvPermissions. Sorry. I got lazy with my posting.
— 7/22/2014 – Changed strings to unicode
— 10/19/2014 – Add @UserLikeSearch and @IncludeMSShipped parameters.
Feb 16, 2015
A few weeks back I introduced HAL002 to a database managed by some annoying devs. They were not just putting NOLOCK on almost every query but they had SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED at the beginning of the stored procedures. HAL’s done his job… Read more
This isn’t so much of a best practice, it comes more under the heading of being careful. Let’s say you have a DELETE statement (or UPDATE) that you need to run. You can certainly put it in a transaction. Run it, test it, then if you’ve made a mistake roll… Read more
Nov 12, 2014
They asked for help again. Every now and again everything slows down and they see a lot of timeouts. They have tried rebooting the SQL instance and that fixes the problem but it’s only a temporary solution. Of course last time they asked for my… Read more
When I decided on security as my topic for February’s T-SQL Tuesday blog party my thought was that security was a topic everyone would have something to say about as it’s something that touches the lives of every DBA at some level or another. Well it turns out I was… Read more
So I’m hosting T-SQL Tuesday this month and decided that since security is something everyone has to deal with it would make a fun topic for this month. I’d actually written this post before I wrote my hosting post for T-SQL Tuesday but it fit so well I couldn’t bring… Read more