SSIS Expression - Convert Date To String

SQL Server Integration Services (SSIS) is a component of the Microsoft SQL Server database software that can be used to perform a broad range of data migration tasks.

SQL Server Integration Services (SSIS) expressions can help make SSIS packages more dynamic.

In general, expressions in SSIS is a combination of literals, functions, operators that yields a single data value.

An expression can be composed of a single value (“abc”) or a variable (@[User::FilePath]) or a function (GETDATE()), or it can be more complex and contains some conditionals (CASE statement) or some mathematical operations or some string manipulation.

Here I am describing how we can convert the datetime into string with SSIS expression.

There are multiple ways to convert date to string. The two ways are listed below.

(DT_WSTR, 4)(YEAR(@[User::PositionDateToProcess])) + "-"+
(DT_WSTR, 2)(MONTH(@[User::PositionDateToProcess])) +"-"+
(DT_WSTR, 2)(DAY(@[User::PositionDateToProcess]))

2. SUBSTRING((DT_STR,30, 1252) GETDATE(), 1, 10)