Category: Databases

General Database Posts

Dates In SQL Server: Adding & subtracting

Dates In SQL Server: Adding & subtracting

Different DBMS systems have different ways of managing dates. As I’m doing a series of articles on dates, I thought I’d throw some notes down about calculating the difference between some of them. Testing dataset Picking up from my article on Dates In SQL Server: Create Sample Date Ranges I’ll use a sample from there to create…

Read More Read More

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

Casual Logging

Casual Logging

Often when running a script, or a stored procedure (with many distinct sections) it’s handy to be able to have the classic “I’m here and the time is X” Logging. I often use this when first looking at monitoring and optimisation of processes. I thought, for my first post , while I get things a…

Read More Read More