Using a Date Table to Track Custom Fiscal Years/Periods

Calendar Tables are only useful if they reflect how your company evaluates its data. Therefore, any company using non-standard financial fiscal years and periods will require customization with their Calendar or Date Table. In this post, I’ll provide an example of how to do so using the M2M ERP System Database. For those who don’t […]

Calendar Tables - Why You Need One.

*** Note: The code below is for use with SQL 2005 and previous versions. I have written new code to take advantage of the Date Datatype in SQL 2008 and above which can be found here.

What is a Date (Calendar) Table?

For the purposes of this article a Date Table is a dedicated table containing a […]

Come See Me Present at SQL Saturday Chicago and Dallas

I’ll be presenting at two SQL Saturdays back to back. You are taking advantage of SQL Saturday events, right?

SQL Saturday Chicago is this weekend (3/26), and I’ll be presenting:

Data Warehousing – How to Convince “The Bobs”

I got a meeting with the Bobs in a couple of minutes…

Building your first Data Warehouse […]

Drawing a Blank. Dealing With Blank Values in SQL Server using NullIf and Coalesce

“Melodical Murray is a human musical instrument; he makes music by blowing his…blank” – Match Game

In the previous article I discussed the issues when working with Null-able fields in Joins and Where clauses. This article will deal with the problems of blank values.

What About Blanks?

Many systems forego the use of Null-able fields, but […]

I Don’t Know! Deal With It! (Nulls)

This topic has been done to death in many places, but I still get frequent questions about Null field issues in T-SQL. My purpose in this article is not to debate the definition of Null. Smarter men than I have already done so.

SQL Server Books Online indicates “A value of NULL indicates that the […]

T-SQL Basics: Different Types of Joins

In this seventh article of the T-SQL Basics Series, we will be covering both the basics as well as some specific issues with SQL Joins. If you’ll recall our last lesson, we wrote a sales query for Master Po. He then requested that we add customer information to the report.

Note, after receiving e-mails from […]

T-SQL Basics - Ordering, Summarizing, and Grouping Data the Kung Fu Way

Today Grasshopper, I will teach you the basics of ordering, summarizing, and grouping your data to give it meaning. Let’s say that the Kung Fu Temple Gift Shop has had poor sales. Master Po wants a list of sales details from you, but he wants them ordered by the part number.

Note for the non […]

T-SQL Basics - Filtering Records with the Where Clause

All of the queries we’ve looked at so far will return all of the records in a table. This isn’t very efficient. The Where clause filters records out of your result set that you do not want.

For example, suppose we’re only interested in Sales Order Master records for “Acme Rockets Inc.” The following select […]

How to Code with Toad

I mentioned in my last article that I would be posting a video showing you the basics of working with Toad for SQL Server.

What do you think of my first effort?


My Way of Coding T-SQL Consistently

As I mentioned in the last article, you need to develop or adopt a standardized way of writing T-SQL code. In this article, I’m going to share the habits I’ve developed, “my way” if you will.

Vizzini: Finish him. Finish him, your way.
Fezzik: Oh good, my way. Thank you Vizzini… what’s my way?
Vizzini: Pick up […]