Solved

manipulating data using ssis in sql server 2005

Posted on 2011-09-22
5
394 Views
Last Modified: 2012-05-12
Hi,
I have an SSIS package that imprts data from a flat file into a database table.
During the import a column is added to the source data with the timestamp of when the package is run...
 ssis
this adds the timestamp to  the LoadDate column of the table
 loaddata
I want the time component of the timestamp to be all zeros
so in this example the entries for LoadDate would be
22/09/2011 00:00:00

I tried  putting the following in  the expression
dateadd(dd,0, datediff(dd,0,getdate())),
but it is not accepted.
any help appreciated thanks.
0
Comment
Question by:blossompark
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:zvytas
ID: 36581287
Expression:

convert(datetime, convert(char, getdate(), 106))
0
 

Author Comment

by:blossompark
ID: 36581380
hi zvytas,
thanks for your input....
this results in the following error message
TITLE: Microsoft Visual Studio
------------------------------

Error at Data Flow Task [Derived Column [278]]: Attempt to find the input column named "datetime" failed with error code 0xC0010009. The input column specified was not found in the input column collection.

Error at Data Flow Task [Derived Column [278]]: Attempt to parse the expression "convert(datetime, convert(char, getdate(), 106)) " failed and returned error code 0xC00470A2. The expression cannot be parsed. It might contain invalid elements or it might not be well-formed. There may also be an out-of-memory error.

Error at Data Flow Task [Derived Column [278]]: Cannot parse the expression "convert(datetime, convert(char, getdate(), 106)) ". The expression was not valid, or there is an out-of-memory error.

Error at Data Flow Task [Derived Column [278]]: The expression "convert(datetime, convert(char, getdate(), 106)) " on "output column "LoadDate" (308)" is not valid.

Error at Data Flow Task [Derived Column [278]]: Failed to set property "Expression" on "output column "LoadDate" (308)".



------------------------------
ADDITIONAL INFORMATION:

Exception from HRESULT: 0xC0204006 (Microsoft.SqlServer.DTSPipelineWrap)

------------------------------
BUTTONS:

OK
------------------------------
0
 

Author Comment

by:blossompark
ID: 36581478
this works

"(DT_DATE)   (DT_DBDATE) GetDate()".

0
 
LVL 5

Accepted Solution

by:
zvytas earned 500 total points
ID: 36581492
Sorry, forgot that SSIS expressions are a but limited. The following should work:

(DT_WSTR,30)(DT_DBDATE)getdate()
0
 

Author Closing Comment

by:blossompark
ID: 36581752
thanks for the update, previous one worked ...will stockpile yours for future use !!
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure 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 Date from a string 4 65
SQL Trigger selecting another database 4 38
How to simplify my SQL statement? 14 53
Addition to SQL for dynamic fields 6 38
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
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.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

803 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