SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

shanmugaraj
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,

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

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
Flowing Fount of Yak Knowledge

1113 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:

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
  Previous Topic Topic Next Topic  
 New 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