Is there a way to split dates into int value year, month, and day and then insert them into SQL server DB using SSIS?
You can use functions, YEAR(), MONTH(), DAY()
Ex:
DECLARE @date datetime2 = '2022-03-09';
SELECT
DAY(@date) AS DAY,
MONTH(@date) AS MONTH,
YEAR(@date) AS YEAR;
DAY | MONTH | YEAR |
---|---|---|
9 | 3 | 2022 |
Reference:
You can use derived column transformation with the built-in date and time functions as follows:
DAY([date_column])
MONTH([date_column])
YEAR([date_column])
Also, you can use the DATEPART()
function as follows:
DATEPART( "day", [date_column] )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.