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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 destination value is the [columndate] - getdate
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

219 Posts

Posted - 08/21/2014 :  02:08:38  Show Profile  Send shanmugaraj a Yahoo! Message  Reply with Quote
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,


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)))


Flowing Fount of Yak Knowledge

2780 Posts

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

FWIW, I tried to understand:


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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000