Solved

SSIS Derive column for converting  bigint datetimekey

Posted on 2013-06-11
7
1,423 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
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql help 8 58
Query Syntax 17 43
sql 2008 how to table join 2 28
SharePoint Destination SSIS 2 12
Lessons learned during ten years of interviewing for SQL Server Integration Services (SSIS) and other Extract-Transform-Load (ETL) contract roles and two years of staff manager interviewing contractors.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 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