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 2012 Forums
 SSIS and Import/Export (2012)
 destination value is the [columndate] - getdate

Author  Topic 

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2014-08-21 : 02:08:38
In table, if the column is having 20140810 [ date in yyyymmdd format ]

Result to be 11 returning in the expression using derived
destination value is the [columndate] - getdate
================

Source Table Column [Valyyyymmdd] [nvarchar](24) NULL
Destination Table Column [DestColumn] [int] NULL,

=================

20130503
20120403
00000000
20110523
20100715
I want to get the difference with getdate()
so i used the below SQL query in my source

DATEDIFF(DAY, IIF( [Valyyyymmdd] ='00000000', CONVERT(VARCHAR(8), GETDATE(), 112), [Valyyyymmdd]) , getdate()) as SalesStageAging
but i need to get the Valyyyymmdd and do ssis derived column to get the difference in date resulting in int value.

I tryed as below

((DT_WSTR,24)DestColumn == "00000000" ? GETDATE() : (DT_DBDATE)(SUBSTRING((DT_WSTR,10)DestColumn,1,4) + "-" + SUBSTRING((DT_WSTR,10)DestColumn,5,2) + "-" + SUBSTRING((DT_WSTR,10)DestColumn,7,2)))


THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-08-21 : 07:56:26
What do you get with your SSIS expression and what do you want to get instead?

FWIW, I tried to understand:

quote:

Result to be 11 returning in the expression using derived
destination value is the [columndate] - getdate



but after reading it through a few times, I still have no idea what you mean. Perhaps some examples of input data and the output you want would help.
Go to Top of Page
   

- Advertisement -