Development

Transact-SQL STRING_AGG

Transact-SQL STRING_AGG

Creating comma separated strings from a column, or delimited strings as I like to call it, is a very common problem in SQL. Beginning with SQL Server 2017 and Azure SQL Database, there is now another option to the existing…

Redgate SQL Prompt Grid Features

Redgate SQL Prompt Grid Features

I love Redgate tools. Most of all, I love SQL Prompt because its features increase my productivity on a daily basis. Recently I discovered a couple of new features for the SQL Server Management Studio results grid. The usefulness of…

Heap tables in SQL Server

Heap tables in SQL Server

In the last post of this blog series, I discussed what a B-Tree index was and briefly explained its history. Before we dive into the indexes which SQL Server uses, it is important to set the foundation of data structures. The…

The ‘B’ in B-Tree – Indexing in SQL Server

The ‘B’ in B-Tree – Indexing in SQL Server

Some people advocate we should count by twelve rather than ten. This is because you can easily count the twelve segments of your fingers by using your thumb as a pointer. With that method, you can count the number of…

T-SQL Tuesday #74 – Be the change (MERGE static data)

T-SQL Tuesday #74 – Be the change (MERGE static data)

Each month, on the first Tuesday of the month, the announcement for the blog party T-SQL Tuesday comes out. Those that are interested then post their blogs, on the subject selected, on the second Tuesday of the month. If you’ve…

T-SQL Search Snippets

T-SQL Search Snippets

Here are two snippets that I use often to search for objects on a variety of servers. The first will search any object within a database and the second will search various elements of SQL Agent jobs. Object search USE…

Counting NULLs and sub-sets of data

Counting NULLs and sub-sets of data

Quick Tip: Counting NULLs and sub-sets of data You have been asked to produce a chart which will visualize a few data points. Total work orders. Total closed work orders (work orders with EndDate populated). Total open work orders (work…

Writing Repeatable T-SQL

Writing Repeatable T-SQL

Writing code for a database is more of a challenge than writing for applications. Before the developers bite my head off, I do not mean that the languages, such as T-SQL, are more difficult or that applications are any less…

SQL Server SCHEMABINDING

SQL Server SCHEMABINDING

SCHEMABINDING is an option that is available for objects in T-SQL which contain user defined code. Examples include, stored procedures, indexes, and functions. Straight from MSDN, SCHEMABINDING… Specifies that the schema is bound to the database objects that it references….