Tag: date

Dates In SQL Server: Iteration of Date Ranges

Dates In SQL Server: Iteration of Date Ranges

When performing ETL functions, it’s often required to run processes with iteration over a given date range. Here are some examples of iterating over dates. These methods can also be applied to other cases where we want to do some iteration. After my previous posts looking at dates, particularly Dates In SQL Server: Create Sample Date Ranges. I…

Read More Read More

Dates In SQL Server: Create Sample Date Ranges

Dates In SQL Server: Create Sample Date Ranges

A data set of continuous dates is useful for cursors and creating date tables. Here I look at ways to produce a list of dates. Continuing my series of posts about dates, I wanted to post something which feeds into lots of examples and testing cases I use day to day in development. I’ll also…

Read More Read More

Dates In SQL Server: DATETIME2 vs SMALLDATETIME

Dates In SQL Server: DATETIME2 vs SMALLDATETIME

While working on the first article about dates Dates In SQL Server: Managing & Manipulating Dates, I touched on the datatypes and realised that it’s worth devoting some time to the subtle but potentially dangerous difference between these two. I previously said: If you need to include time (so not just the whole day) then…

Read More Read More

Dates In SQL Server: Managing & Manipulating Dates

Dates In SQL Server: Managing & Manipulating Dates

Working with dates correctly gives us a lot of power. Dates are a surprisingly complex part of databases, especially if we take into consideration the general complexities in calendars. SQL Server has a lot of subtleties, and some formatting nuances which can be difficult to remember. This is the first in a short series of articles…

Read More Read More