d90
d90

Reputation: 787

BIDS\SSIS Derived day of week from date

I need to derive a column to be imported from CSV to ms sql. I have a date field, but I also need a day of week field, represented numerically. for example monday would be 2. Is there a way to do that as an expression in "Derived Column Transformation Editor", similar to the Weekday() function in excel?

Upvotes: 2

Views: 4280

Answers (1)

AHiggins
AHiggins

Reputation: 7219

If by 'BIDS' you mean 'SSIS', I believe you are looking for the DATEPART() function: you can extract the day number using DATEPART("DW",[MyDateField]). This will return 1 for Monday, 2 for Tuesday ... 7 for Sunday.

Link with additional info

Upvotes: 1

Related Questions