Solved

Using GetDate() in SSIS with Derived transformation

Posted on 2007-03-29
4
1,158 Views
Last Modified: 2013-11-30
Guys:
I’m trying to add a new column using the Derived Column transformation; I need to accomplish the following but not having any luck:

Need to substract 1 ½ day from Current time.
This is what I have:

GETDATE() – 1.5

This is not working,  I know I have to use a cast operator but can’t figure out which one.
0
Comment
Question by:Oneill0003
  • 2
4 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 18819521

use

dateadd(h,-36,getdate())

ie 36 hours

the date day subtraction uages only allows for integer days...
0
 

Author Comment

by:Oneill0003
ID: 18819609
What about if i need to substract 20 minutes?

0
 
LVL 8

Accepted Solution

by:
drydenhogg earned 125 total points
ID: 18822110
dateadd(mi,-20,getdate())
0
 

Author Comment

by:Oneill0003
ID: 18822938
Thanks drydenhogg that worked great!


DATEADD("Minute",-20,GETDATE())
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Syntax 5 34
Inserting oldest record into new table. 5 22
always on switch back after failover 2 32
T-SQL Default value in Select? 5 24
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

785 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