SQL MERGE

When working with tables in SQL, you will inevitably need to combine the contents of two or more tables at some point.  The SQL MERGE statement provides a quick and straight-forward way to accomplish this task.  The SQL MERGE statement performs insert, update, or delete operations on a target table based on the results of … Read more

SQL NULL

When working with tables in SQL, you will sometimes encounter field values that are empty or missing, which is referred to as NULL.  This occurs during the creation of a record in a given table, when the field is not required to have a value.  This differs from zero values or spaces, and cannot be … Read more

SQL CHOOSE Logical Function

The SQL CHOOSE Logical Function returns the item at the specified index from a list of values in SQL Server.  I’ve used it sporadically, but it equates to a work around for the CASE statement, making the query a bit more readable in some instances.  Let’s get to a couple examples. SQL CHOOSE Logical Function … Read more

SQL IN Logical Operator

The following post provides a few simple examples on how to utilize the SQL IN Logical Operator when executing T-SQL statements.  There are several techniques that make this a very useful statement in the WHERE clause. From the Microsoft Documentation site:  Logical operators test for the truth of some condition. Logical operators, like comparison operators, … Read more

SQL CONCAT

Transact-SQL (TSQL) Quick Tips – SQL CONCAT In many cases I need to bring together two separate fields to create a new field.  Whether it be for display purposes, informational or joining to another table, the ability to combine two fields into one comes up frequently in my day-to-day work. Starting with SQL Server 2012, … Read more

SQL Query Database Size

Transact-SQL (TSQL) Quick Tips – SQL Query Database Size I recently experienced a situation where disk space was close to capacity.  We manage a lot of databases and wanted to get a quick understanding of which particular databases were taking up the most space.  Using the following query, you can easily view the full list of databases on a specific server, … Read more