The Bit Bucket

Opinion: Don't have blind faith in hardware

There was a discussion the other day (on one of my lists), where someone pointed out that over many years, they had made tape backups, sent them via secured transport, and then paid for high-tech storage. And when they went to restore one of the tapes recently, there was nothing on the tape.

Over the years, I’ve lost count of the number of times I’ve heard stories like this. Long ago, I realized that you must never trust hardware.

2018-08-21

SQL: Make sure to use ORIGINAL_LOGIN when auditing

I regularly see code where SQL Server DBAs and developers are trying to log which user/login took a particular action within the database. There are many functions which appear to return the information needed, but there’s only one that should normally be used: ORIGINAL_LOGIN().

A login is the way that a connection is authenticated to the server ie: it’s the “who are you?” at the server level.

Most times, a user is a mapping of that login to a particular database.  The login and user will often have the same name (and I’d recommend that you do that to avoid confusion) but they do not have to be. A login Terry could be a user Mary in one database and a user Nga in another database.

2018-08-20

Book Review: Introduction To Personal Branding - Mel Carson

Over the last few months, I’ve also been reading a number of branding-related books. One that caught my eye was Introduction To Personal Branding: Ten Steps Toward A New Professional You by Mel Carson.

Part of the reason I looked into it was that Mel was an evangelist at Microsoft and as most would know, I spend a lot of time dealing with Microsoft in various ways.

It was also interesting as it’s a low cost book that Mel has published using CreateSpace and I’d often wondered about using that so I thought I’d check the outcome of that as well. Finally, it’s a short book. Listening to it on Audible would probably only take an hour or two.

2018-08-17

Shortcut: Viewing client statistics in SQL Server Management Studio

While SQL Server is quite fast at executing queries, when you are connecting from a client application like SQL Server Management Studio (SSMS), you might wonder how much time SQL Server spent executing the query, as opposed to how long the communication with the server took.

This type of information is available in the Client Statistics.

Let’s see an example. If I connect to a server in an Azure data center, I’ll have higher latency than for one in my own site. That will affect the wait time for a server response.

2018-08-16

SDU Tools: Extract Trimmed Words from T-SQL Strings

Occasionally I’ve needed to take a string, and extract all the words out of it. For example a string like ‘hello        there     greg’ might lead me to want the three words ‘hello’, ’there’, and ‘greg’. Note that I usually want them trimmed, not just extracted.

In our free SDU Tools for developers and DBAs, we added a table-valued function ExtractTrimmedWords to help with this. You can pass it a string, and it will pull it apart for you, assuming that you have whitespace separating the words.

2018-08-15

Opinion: Avoid annual subscription surprises for your customers

Yet again, a few days back, I received two invoices that showed I’d just paid (via PayPal fortunately) a pair of annual subscriptions. These are subscriptions that I thought were already cancelled, and we’d stopped using the products many months back.

The problem is that I’ve now spent quite a bit of my time, and quite a bit of the vendor’s time trying to work out how to cancel and reverse them. For days now we’ve had emails going backwards and forwards between ourselves and the 3rd party that they use for provisioning/charging.

2018-08-14

SQL: The T-SQL SIGN function and what's in a return type?

When you’ve worked with a product like SQL Server for a long time, and more importantly, are one of the odd people who’ve read a great amount of the documentation simply for interest, it feels really strange to come across a basic function that you’d never noticed before. That’s how I felt when someone mentioned the T-SQL SIGN function.

I thought, “the what function??”.

Now it works pretty much as you’d expect. It returns:

2018-08-13

Book Review: Don't Sweat the Small Stuff - Richard Carlson

I’ve been going through a number of fairly famous books or ones that have spawned their own industry. One of those was Don’t Sweat the Small Stuff and it’s all small stuff: Simple Ways to Keep the Little Things From Taking Over Your Life by Richard Carlson.

This one intrigued me as there are now so many follow up versions. There’s a “for teens”, “for men”, “at work”, etc. etc. etc. along with ancillary items like workbooks. So I presumed there must have been something to it.

2018-08-10

New online on-demand SQL Server courses from SQL Down Under

Hi Folks,

We have a whole series of online and on-demand courses coming. The first two of these are available right now.

The good news? The first one is free and the second one has a big introductory discount.

The first course 4 Steps to Faster SQL Server Applications is a short course for developers, new DBAs, and testers, etc. who don’t know anything much about tuning SQL Server applications. It focuses on finding and fixing the most problematic queries, either in terms of index tuning, or removing repetitive queries, all using free tools.

2018-08-10

Shortcut: Adding additional parameters to connections in SSMS

When I am writing my own code using a .NET (or other) language, I have a great deal of control of how the connection string that my application uses to connect to SQL Server is configured.

In particular, I might need to add another parameter or two.

As a simple example, you might have a multi-subnet Availability Group, spread across a production site and a disaster recovery site. It’s common to then have an Availability Group Listener in both subnets.

2018-08-09