SSIS MONTH Function

The SSIS MONTH function is a Date/Time function that returns the Month datepart number (1 to 12) from the given date in integer format. This article explains how to use the MONTH function with an example and the syntax for getting the Month number from the date value is as shown below.

MONTH(<<date>>)

To demonstrate the MONTH function, we use the Employee table below, which has 15 records. Please refer to the Union All Transformation, Derived Column Transformation, Built-in methods, and SQL Server articles in SSIS.

Source Table

SSIS MONTH function

For this MONTH example, add a Data Flow Task and double-click on it to enter the Data Flow region. Next, add the OLE DB Source to read data from the above SQL database table. Please join the OLE DB Source to Derived Column Transformation because it helps to write MONTH expressions and create new columns.

Data Flow to add Derived Column

Next, double-click on it to open the Derived Column Transformation Editor. Drag and drop the SSIS MONTH function to the row cell under the Expression and replace the <<date>> with the DateTime column to return Month numbers (1 to 12). Either you can manually delete the complete <<date>> expression or drag and drop the HireDate column will automatically replace it.

The first expression returns the Month number from the HireDate column. The second SSIS MONTH function expression returns the month number from the current system date.

MONTH( [HireDate] )

MONTH( GETDATE() )
SSIS MONTH Function expression

Click OK to close the Editor window.

Drag and drop the Union All Transformation and connect the Derived Column to it. Next, right-click on the connection node and choose the Enable Data Viewer. Please run the SSIS MONTH function package to see the Month number from the HireDate column and the current system date.

SSIS MONTH Function output