Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Derived Column in SSIS package

Author  Topic 

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2011-03-11 : 05:08:41
Hello there

I am trying to create a derived column into my ssis pack with the following requirements

I have a status date and want to look for dates that go from 9 days ago to the current day (getdate() )

I am using the following syntax. but not sure where i am going wrong.

ISNULL(STATUS_DATE) ? 0 : (YEAR(STATUS_DATE) == (DATEADD(day, DATEDIFF( day,0, GETDATE() ),0) -9) && GETDATE())? 1 : 0

could someone point me in the right direction please

Kind Regards

Rob

MCTS / MCITP certified

latch
Yak Posting Veteran

62 Posts

Posted - 2011-03-11 : 10:14:13
Hi,

I assuming like these:
if status_date has values like:
03-21-2011
03-22-2011
03-02-2011
03-11-2011
03-02-2010
03-21-2009
i am creating the derived column as :
ISNULL(status) ? 0 : ((DATEDIFF("day",(dt_date)status,DATEADD("Day",-9,GETDATE()))) == 0 ? 1 : 0)

if the incoming status_date equals to 9 days ago to today date then
result column will be 1 else 0.

0
0
1
0
0
0

Thanks,
latch


Go to Top of Page
   

- Advertisement -