It’s been almost 3 years since I updated these SPs! I can’t believe so much time has gone by! Well, I’m sure all of you have been holding your collective breath but I finally have some new updates. I’m particularly excited about the @DropTempTables and @Output options.
Just as a… Read more
I was working on a blog post this weekend that required a list of random numbers. Now, this isn’t exactly an uncommon task, but it’s not as easy as it would seem. The random number function RAND() has a few inherent flaws. And from what I can remember the random… Read more
Any object within a database in SQL Server has what is called a four part name. Which rather implies four pieces right? Simple enough
And you can find the lists of each of those pieces in
The breakdown is nice but how about usage?… Read more
Compressing your backups has very few downsides. It’s usually faster (the additional time for compression is less than the time saved by reduced IO) and of course, the backups are smaller. I have run into a few issues, however.
On one occasion there was 75gb free on a drive, the… Read more
The daily (database-related) WTF
Database horror stories. Things that make your eyes pop and not in a good way. What a fun topic! But not an… Read more
My company has recently adopted a Cloud first attitude. Now that’s different from Microsoft’s Cloud first. Microsoft is putting new features in the Azure first, then at regular intervals (the releases) those changes get pushed to on-premises versions of the applications. Our version means, in any new development check… Read more
Recently, Aaron Bertrand (b/t) posted Performance Surprises and Assumptions : GROUP BY vs. DISTINCT. In it he says he prefers GROUP BY over DISTINCT. He discusses the fact that GROUP BY will, in fact, under certain circumstances, produce a faster query plan. I highly recommend… Read more
One of the most common ways to get an event notification is by email. So what happens when you get 500 emails in a day and only one or two are actionable? Do you read every single email? Spending quite literally hours to find those one or two gems? Or… Read more
These are those queries where you are pulling for, let’s say, a first name, a last name, a state, and/or a city. Simple enough, until you notice that or. We might only get a first name, or a state and the query still needs to work. These queries are… Read more
Restoring a backup file is pretty easy right?
RESTORE DATABASE [Test] FROM DISK = 'C:\backups\backup.bak';
Ok, but what if more than one database backup is stored in that single backup file? Didn’t know you could do that?
Yep. You can.
BACKUP DATABASE [Test] TO DISK = 'C:\backups\backup.bak'; BACKUP DATABASE [AdventureWorks2014]…
Growing up my mother used this phrase quite a bit. Penny wise, pound stupid. (In case you didn’t know the pound is the British equivalent of the dollar.) Basically, it means paying attention to the small stuff at the expense of the big stuff. My favorite example of this… Read more
I had an interesting problem recently. A database was stuck in single user mode. How exactly was it stuck you ask? Well, 4-5 system sessions were holding locks on the database (and blocking each other). Which meant I wasn’t able to get exclusive use of the database which is required… Read more
Sometimes you have a requirement to grant permissions to every database on an instance. Historically this has required creating a user (database level principal) on each database and granting it the correct permission. And making sure to grant those permissions to the model database so that future databases have the… Read more
Everyone deals with deadlocks from time to time. But sometimes we need to control who’s the deadlock victim and who isn’t. For example, I’m doing a big delete on a table in a 24×7 environment, I can’t afford downtime to do it so I’m doing my delete in small… Read more
The SQL Tiger Team (t) has recently put out a guided walkthrough for SQL Connectivity issues.
If you look at the bottom of the announcement you’ll also notice links to walkthroughs for
I’m… Read more
When you open SSMS a connection window automatically comes up. Then once you pick your server, connection type, username and password (if needed) you get an object explorer connection.
But what if that isn’t what you want?
Throughout the Azure portal you will find buttons called Quick Start. You won’t find it everywhere but I’ve found it in the Resource… Read more
My recent post on why SQL logins aren’t working has generated a couple of follow up posts. The first one was on how to create a connect item and then this one. It was pointed out to me that the errors in the log have quite a bit more information… Read more
I recently wrote a blog about how to tell why your SQL login isn’t working. There were a lot of good comments and several of them suggested that I create a connect entry to make the error easier to understand. There was also a question of how to create… Read more
Blocking is just part of life I’m afraid. Because we have locks (and yes we have to have them, and no, NOLOCK doesn’t avoid them) we will have blocking. Typically it’s going to be very brief and you won’t even notice it. But sometimes you get a query or… Read more