Fabric-Sql-Db

Data Tales 2: The case of the exploding table

Data Tales 2: The case of the exploding table

This is the second tale in a series of stories about data. I hope you enjoy the series.

I was recently at a customer site where the developers were very concerned about the impact of adding columns to a table. They told me that when they added a new column that their deployment code was timing out and the database was massively increasing in size.

The table had increased from around a small size to well over 50GB during the single operation. The deployment operation involved adding the column and writing one row to a deployment history table. Because they were only writing a single new row, they were blaming SQL Server for bloating the database size when a column was added.

2025-09-03

SQL Interview: 75 Boolean logic with NULLs

SQL Interview: 75 Boolean logic with NULLs

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Development Level: Intro

Question:

In the following WHERE clause, both AColumn and AnotherColumn are NULL.

WHERE AColumn = AnotherColumn

What is the effect of the WHERE clause?

Answer:

In SQL boolean logic, the expression NULL = NULL returns NULL and not True. So the WHERE clause would exclude the rows.

2025-09-01

Data Tales 1: The case of the auto-truncating data

Data Tales 1: The case of the auto-truncating data

This is the first tale in a series of stories about data. I hope you enjoy the series.

I have a number of clients that I spend a day or two with each month. I like this style of engagement as I get to know the staff and their systems over a period of time, can see the improvements that we make over time. The staff members also know that if they have issues that aren’t desperate, they can save them up for the days that I am onsite. When I arrived at one of these customer sites recently, several of the staff members had grins on their faces, and one told me that Terry (well let’s call him Terry anyway) had really broken something.

2025-08-30

SQL Interview: 74 Revoking permissions

SQL Interview: 74 Revoking permissions

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Security Level: Medium

Question:

Is it possible that revoking a permission can cause a user to be able to access a resource, when they previously could not?

If so, how?

Answer:

REVOKE can remove either a GRANT or a DENY. Revoking a DENY can cause a user to be able to access a resource that they previously could not.

2025-08-28

SQL Interview: 73 Orphaned users

SQL Interview: 73 Orphaned users

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Administration Level: Medium

Question:

In SQL Server, what is an orphaned user?

How do users typically become orphaned?

Answer:

An orphaned user is one that appears in a database, but the server principal that they are linked to, does not exist.

2025-08-24

SQL Interview: 72 Dynamic data masking and encryption

SQL Interview: 72 Dynamic data masking and encryption

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Development Level: Advanced

Question:

Is dynamic data masking a form of encryption?

Answer:

No. Dynamic data masking just obfuscates the data when it is presented to end users. It is unrelated to encryption.

Obfuscation is not a form of encryption.

2025-08-20

SQL: The need for enumerations in T-SQL

SQL: The need for enumerations in T-SQL

I recently wrote about the need for T-SQL to have constants. I received a lot of feedback on that.

Everyone seemed to agree, although one or two asked Why bother as Microsoft isn’t really listening now about enhancing T-SQL?. I understand that sentiment but I don’t think things are quite as bleak as some are suggesting. I currently sense a stirring within the product group, where there is a new interest in developers.

2025-08-18

SQL Interview: 71 Potential issues with NOLOCK

SQL Interview: 71 Potential issues with NOLOCK

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Administration Level: Advanced

Question:

You have applications that make extensive use of NOLOCK hints. You have heard that this can cause issues.

Which of the following issues could occur as a result of using NOLOCK hints?

  • Duplicate rows
  • Phantom rows
  • Missing rows

Answer:

2025-08-16

SQL: The need for constants in T-SQL

SQL: The need for constants in T-SQL

If you look at the code in the image above, I have one immediate reaction.

What are those numbers that are sprinkled throughout the code?

I see this all the time in T-SQL code. Yet in any programming language, it’s a really poor idea to do this. It leads to very fragile code that’s so hard to maintain longer-term.

So why do people do it?

So, you might wonder why people do this in T-SQL. Couldn’t they just do this at the start of the code?

2025-08-14

SQL Interview: 70 Updating statistics during index rebuilds

SQL Interview: 70 Updating statistics during index rebuilds

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Administration Level: Advanced

Question:

When you rebuild indexes, are statistics on the table automatically rebuilt?

If not, why?

Answer:

Rebuilding indexes updates the statistics for the index, but column statistics are not updated unless they are tied to the index.

2025-08-12