The Bit Bucket

Another new online course: Protecting SQL Server Data with Encryption

We all see news articles talking about how company after company exposed private details of their clients, customers, and sometimes, even staff. In so many cases, a reasonable approach to encryption would have avoided these issues. Time and again though, I see people doing dodgy work on protecting their data; some even trying to roll their own protection.

Don’t do this!

Encryption is one of the most important yet least understood technologies in SQL Server. It’s improved so much over the years and 2019 makes it even better.

2019-04-23

T-SQL 101: 14 Using two part names for SQL Server tables and other objects

If you look carefully at the following simple query:

you’ll notice that I didn’t just say FROM Cinemas, I said FROM dbo.Cinemas. The “dbo.” part is the name of the schema. I talked about schemas in an earlier post. And all through these T-SQL 101 blog posts, I keep mentioning that you should always use the schema name as well as the object name.

By why?

[caption id=“attachment_2806” align=“alignnone” width=“312”] Image by Ken Treloar[/caption]

2019-04-22

SQL: Do Indexed Views really require Enterprise Edition of SQL Server?

According to Wikipedia, Betteridge’s law of headlines is an adage that states: “Any headline that ends in a question mark can be answered by the word no.” In this case, they’re correct because the answer is no. But as with most things in this industry, there are subtle issues with that answer.

In SQL Server, a view is just a SELECT statement that’s been given a name. That’s pretty much it. No data is stored, and every time you access the view, the query optimizer expands the view into the surrounding query. By the time you get to an execution plan, the view is nowhere to be found.

2019-04-19

SQL: Fixing Locking and Blocking Issues in SQL Server - Part 1

I get lots of requests to help customers with their SQL Server systems. Many, many requests start with customers asking me if I can help them fix their blocking issues. Most customers aren’t actually aware of true blocking issues. Invariably what they mean, is that they’ve started to have deadlocks and things are blowing up.

[caption id=“attachment_4816” align=“alignnone” width=“384”]Awesome image by Jens Johnsson Awesome image by Jens Johnsson[/caption]

Is blocking really the issue?

I always start by working out if they really have a blocking issue. When I see performance problems, after eliminating obvious hardware and configuration issues, I’d say the issues fall into these buckets:

2019-04-18

SDU Tools: All the Versions of SQL Server using SQLServerProductVersions

I can’t tell you over the years how many times I’ve gone searching for details of a SQL Server build and/or related knowlegebase article. There are some sites that provide much of this, but I’d like to have it in a programmatic form. I can easily then use it in utilities and in my SQL scripts.

In our free SDU Tools for developers and DBAs, we added a view and a number of functions to help with this. The primary one is a view called SQLServerProductVersions.

2019-04-17

New Online Course: SQL Server Service Broker for Developers and DBAs

I’d love to be running Service Broker classes more often. Service Broker is one of the most powerful, yet least understood technologies in SQL Server. Many of our enterprise clients are using it and loving it.

What we tend to find though, is that we get requests from a number of interested people, spread over time, and locations. But not enough to run in-person classes in those locations.

So we decided to fix that, for this course and for a number of our other courses that have similar demand (i.e. Spatial, Replication, and more).

2019-04-16

T-SQL 101: 13 Quoting (Delimiting) Identifiers in T-SQL

If you look carefully at the following two queries in the image below:

you’ll notice there are a couple of differences. In the first query, the word Description is blue, and in the second, it isn’t blue but it has square brackets around it. The second is an example of quoting or delimiting an identifier.

In this case, the reason that the word was blue in the first query is that somewhere in SQL Server, this word is part of the syntax of the language itself. That’s much the same as SELECT or ORDER BY. So SQL Server Management Studio (SSMS) color-codes it the same way it does for the word SELECT.

2019-04-15

SQL in the City - Brisbane, Christchurch, Melbourne - Hope to see you there

I’m presenting a session on Azure DevOps for SQL Server DBAs that’s designed as an intro for data people who haven’t really worked with it before, at Red-Gate’s SQL in the City events in Brisbane (May 31), Christchurch (June 7), and Melbourne (June 14).

Looks like a fun lineup for the day, and it’d be great to catch up with you at one of those events. You can find more info here:

2019-04-12

SQL: Fix - Missing Font Options in SQL Server Management Studio (SSMS) 17.x

Ever since about version 17.3 of SQL Server Management Studio, I’ve had problems with fresh installs (as opposed to upgrades). I’ve been unable to set the fonts and colors. When I go into that dialog, I see the list as shown in the main image above.

All the normal option for windows that you can make settings for aren’t there.

On my current machine, I had just installed a v18 SSMS and it was fine. All font options, etc. were there. But I had to install v17.9.1 of SSMS side-by-side because the ssbdiagnose tool was missing on my machine. (I needed it for our new Service Broker course and v18 doesn’t install it for some reason).

2019-04-11

SDU Tools: CalculateTableLoadingOrder - follow table dependencies in T-SQL

If there is a reasonable number of tables in a SQL Server database, and I’ve also got foreign keys linking them, it can be difficult to work out the order of the dependencies. That’s a hassle when I want to load data, and for other admin functions that I might need to perform. So we’ve fixed that.

In our free SDU Tools for developers and DBAs, there’s a stored procedure called CalculateTableLoadingOrder.

2019-04-10