Reputation: 197
I want to find out the day of the week from date in ssis.
Actually i want to move the data from one server to another,
In the source server there is one cloumn reportdate having the previous date,so while i wan to copy in to the destination server wan to insert todays date,but there is one case like there is no data comes on sunday in the source server in that case i will have the data of saturday so in this case i want to update the date in the destination server with 2 days plus,please let me know how can i reslove this using ssis.i'm using derived column for manipulating the date column DATEADD("day",2,reportdate) : DATEADD("day",1,reportdate)
,
so first part will update the date plus 2 of the sourcedate into the detsination table date but how will i find the day of week means when the saturday comes...please let me know how can i reslove this using ssis.
Thanks is advance..
Upvotes: 0
Views: 4216
Reputation: 12271
Try this :
DATENAME(weekday, GETDATE())== "Sunday" ? DATEADD("day",2,reportdate):
DATEADD("day",1,reportdate)
Use GETDATE()
else use DATEADD(day,-1,reportdate)
in the above expression
Update
:
Use DATEPART
in SSIS
DATEPART( "Weekday", getdate())
Expression is
DATEPART("weekday", GETDATE()) == 1 ? DATEADD("day",2,getdate()):DATEADD("day",1,getdate())
The above expression works in my system having SSIS 2008
Upvotes: 2