Reputation: 787
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
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.
Upvotes: 1