?
Solved

SSIS Derive column for converting  bigint datetimekey

Posted on 2013-06-11
7
Medium Priority
?
1,535 Views
Last Modified: 2016-02-11
Hi,

I have a issue converting Datetime field to integer using derive column.
it could be a limitation on derive column.

my Derive column expression as follows:

YEAR(ValidLastAlertDate) * 100000000 + (MONTH(ValidLastAlertDate) * 1000000) + DAY(ValidLastAlertDate) * 10000 + DATEPART("hh",ValidLastAlertDate) * 100 + DATEPART("mi",ValidLastAlertDate)


Data Types:

four-byte signed integer [DT_I4]                                                

Can anybody has the solution to this?

Thanks in advance
0
Comment
Question by:keplan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 17

Expert Comment

by:Kent Dyer
ID: 39239974
0
 
LVL 17

Expert Comment

by:Kent Dyer
ID: 39239985
Here is another way..

select ValidLastAlertDate
,(CONVERT(BIGINT,YEAR(ValidLastAlertDate)) * 100000000)+(CONVERT(BIGINT,MONTH(ValidLastAlertDate)) * 1000000)+(CONVERT(BIGINT,DAY(ValidLastAlertDate)) * 10000)+DATEPART("hh",ValidLastAlertDate) * 100+DATEPART("mi",ValidLastAlertDate)
 from YOUR_TABLE (nolock) where [id]=1

Open in new window


HTH,

Kent
0
 

Author Comment

by:keplan
ID: 39240803
Hi HTH,

I need this to be achieved through SSIS.
So Is this a limitation on SSIS
0
What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

 
LVL 21

Expert Comment

by:Jason Yousef, MS
ID: 39240831
Hi,
what's the expected output (result) ?  not data type...
0
 

Author Comment

by:keplan
ID: 39243017
Out come is the DateTimeKey as interger value:

Eg:

201305301230
0
 
LVL 21

Accepted Solution

by:
Jason Yousef, MS earned 1480 total points
ID: 39248340
[DT_I4]   is INT and that's small for your expected output...
cast to BIG int instead [DT_I8]
(DT_I8)YEAR(ValidLastAlertDate) * 100000000 + (MONTH(ValidLastAlertDate) * 1000000) + DAY(ValidLastAlertDate) * 10000 + DATEPART("hh",ValidLastAlertDate) * 100 + DATEPART("mi",ValidLastAlertDate)

Open in new window


Please let me know if you got an error and what's the error.
0
 

Author Closing Comment

by:keplan
ID: 39249499
Good
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question