Avatar of PRINCE101
PRINCE101
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Converting of date to integer

Hi,

Am trying to populate a snapshot fact table, i decided to add a derived column to get the current date but then i need to write an expression to convert the date into integer value as my destination is integer. this is my expression (DT_WSTR,30)(DT_DBDATE)GETDATE() and i did the data conversation to four-bye signed which brought the error below.
any help on how to convert the current date to an integer so i can mapped the source and the destination correctly..
many thanks


[Get Today's Date [902]] Error: An error occurred while attempting to perform data conversion. The source type could not be converted to the destination type.
[Get Today's Date [902]] Error: SSIS Error Code

DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "component "Get Today's Date" (902)" failed because error code 0xC0049062 occurred, and the error row disposition on "output column "TodaysDate" (908)" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.
Microsoft SQL ServerMicrosoft Applications

Avatar of undefined
Last Comment
PRINCE101

8/22/2022 - Mon
David Johnson, CD

Question: why use an int rather than a date?
Question: What is the format of your integer yyyymmddhhmm ??  yymmddhhmm ? yymmdd?

which style of date are you using date2? maybe converting it to a nvchar and then to an int may be what you need to do?
SOLUTION
Olaf Doschke

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
PRINCE101

ASKER
Thank you all.. you guys are live saver.. glad to link with you guys
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes