The Bit Bucket

PowerShell: New-Object : Constructor not found. Cannot find an appropriate constructor for type

PowerShell: New-Object : Constructor not found. Cannot find an appropriate constructor for type

This blog post is here so that I don’t forget it in future.

I’ve been writing Powershell again all day today and I spent ages trying to find this error when instantiating a particular object.

Bottom line is that there was a valid constructor that took a single string argument. However, I was passing an empty string to the constructor. I won’t tell you what I really think about that error message. Let’s just leave it at The error message returned is interesting.

2025-08-26

SSMS Tips and Tricks 5-4: Finding error locations within scripts

SSMS Tips and Tricks 5-4: Finding error locations within scripts

This is probably one of the simplest tips that I’ve published, yet I’m endlessly surprised how many people do not realize that it’s available.

When you have a script loaded in SSMS, and you execute the script, you might run into an error like this:

To find where the error is, just double-click the error down in the Messages tab. I double-clicked it, and it took me directly to the error and highlighted it:

2025-08-25

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

SSMS Tips and Tricks 5-3: Using the XML editor and increasing the XML output size

SSMS Tips and Tricks 5-3: Using the XML editor and increasing the XML output size

Most people use SSMS to edit SQL queries. No big surprise there. The files will have a file type of .sql.

But what many people don’t understand is that SSMS inherits many of its underlying Visual Studio’s abilities to edit other document types.

For example, if you open a .txt text file, you can edit it just fine, and you can also include files like this in SSMS script projects. That can be useful for additional notes and documentation.

2025-08-23

Book Review: Getting Started with Graph Query Language (GQL)

Book Review: Getting Started with Graph Query Language (GQL)

Another book that I recently received for review from my friends at PackT Publishing was Getting Started with Graph Query Language (GQL) by Ricky Gun, Jason Zhang, and Yuri Simione.

The subtitle is The complete guide to designing, querying, and managing graph databases with GQL.

I’ve worked with a number of graph-based databases over the years and I was interested to see where GQL is heading.

SQL Server Graph

In 2017, graph databases were all the rage, and so I wasn’t surprised when the SQL Server team decided to implement graph functionality within SQL Server.

2025-08-22

SSMS Tips and Tricks 5-2: Viewing and configuring spatial data output

SSMS Tips and Tricks 5-2: Viewing and configuring spatial data output

SQL Server 2008 added the ability to work with spatial data by the additional of the geometry and geography data types. When they first were added, there was no tools support for working with them, and all we had was direct manipulation of their internal binary storage.

Here’s an example:

I’ve defined a variable named @Shape of type GEOMETRY. I’ve then assigned a shape to it, based on a polygon formed by a set of points. If you look carefully, you’ll notice that it’s a square.

2025-08-21

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

SSMS Tips and Tricks 5-1: Changing the number of rows selected or edited in Object Explorer

SSMS Tips and Tricks 5-1: Changing the number of rows selected or edited in Object Explorer

When you right-click a table in SQL Server Management Studio, you get options for selecting or editing but the number of rows is limited:

Those values can be changed. By default, these numbers are both 200, but I’ve decided to change the default number of rows selected to 1000.

In Tools, Options, SQL Server Object Explorer, then Commands, you can set the values to whatever suits you:

I don’t tend to ever use the Edit option but I’d suggest not making it too large.

2025-08-19

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

SSMS Tips and Tricks 4-10: Using Activity Monitor

SSMS Tips and Tricks 4-10: Using Activity Monitor

This is a quick tip but an important one. I see many people using SSMS and they aren’t aware of Activity Monitor.

While there are many clever things that we can do with queries, to interrogate the health of the system, don’t forget that there is quite a bit of useful information in Activity Monitor, and it’s easy to get to.

There are two basic ways to launch Activity Monitor. The first is to right-click the server in Object Explorer:

2025-08-17