07 October 2019
07 October 2019

SQL and Scope

Understanding scoping rules is a basic skill for developers. In this article, Joe Celko gives a bit of the history of scoping in early programming languages and shows how scoping applies to SQL queries as well. … Read more
15 July 2019
15 July 2019

Modeling Time

There are those who argue that time doesn’t really exist; it’s just an illusion. That debate won’t keep you from storing and manipulating dates and time in SQL Server. In this article, Joe Celko discusses some of the many ways that SQL Server treats temporal data types.… Read more
13 March 2019
13 March 2019

Converting a History Table into a System-Versioned Temporal Table

Temporal tables were introduced with SQL Server 2016. To take advantage of this feature, you might start fresh with a brand new table. It is possible, however, to convert an existing table with accumulated history to the new functionality. In this article, Mala Mahadevan explains how to create temporal tables for both scenarios.… Read more
12 March 2019
12 March 2019

Why You Shouldn’t Hardcode the Current Database Name in Your Views, Functions, and Stored Procedures

“There are only two hard things in Computer Science: cache invalidation and naming things”Phil Karlton I’m terrible at naming things. I recently wrote some quick code to reproduce a design problem and demonstrate several options for solutions, and later realized that I’d named my objects dbo.Foo, dbo.FooFoo, and dbo.Wat. But I feel strongly about a … Read more
10 January 2019
10 January 2019

Empty Thoughts: Working with NULL

Whether or not to have NULLable columns in a table can be a religious debate, and how missing data is represented should be carefully considered during database design. In this article, Joe Celko considers the ways that SQL Server handles NULLs in several situations. … Read more
05 December 2018
05 December 2018

Data Quality

Problems with data quality are easier and cheaper to prevent than to solve later. In this article, Joe Celko talks about data quality and where the issues tend to happen.… Read more
24 August 2017
24 August 2017

Why is My Database Application so Slow?

When your application is running slowly, the reflex action is to blame the database queries. It is certainly true that some of the more extravagant delays can be fairly blamed on a missing index or unnecessary locking, but there are other potential villains in the drama, including the network and the application itself. Dan Turner points out that you could save a lot of time and money by working out for sure where the problems lie before diving into the detail.… Read more
04 August 2017
04 August 2017

The Power of Python and SQL Server 2017

Python is new to SQL Server 2017. It is intended primarily to allow the use of Python-based machine-learning within SQL Server, but it can be used for far more than this, with any Python libraries or Frameworks. To provide an example of what is possible, Hitendra shows how to use the feature securely to provide intelligent application caching, where SQL Server can automatically indicate when data changes to trigger a cache refresh. … Read more
01 August 2017
01 August 2017

Using SQL Server Query Hints with Entity Framework

Entity Framework (EF) is designed to work with a variety of data sources. Although this presents many advantages, there is a downside that many of the special features of a data source such as SQL Server are off-limits. Query Hints are an example: though often misused, they are occasionally important. Dennes Torres shows how you can use these in EF, using a command interceptor that will allow you to use any query hint with SQL Server.… Read more
17 July 2017
17 July 2017

SQLCLR in Practice: Creating a Better Way of Sending Email from SQL Server

SQLCLR is now considered a robust solution to the few niche requirements that can't be met by the built-in features of SQL Server. Amongst the legitimate reasons for avoiding SQLCLR, there is the fear of getting bogged down in code with special requirements that is difficult to debug. Darko takes a real example, extending the features of sp_send_dbmail, to demonstrate that there need be few terrors in SQLCLR. … Read more