Solved

manipulating data using ssis in sql server 2005

Posted on 2011-09-22
5
397 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying 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
insert query with value having 's 2 58
Sql Permission 6 67
Following an example - removing duplicate strings 4 61
INSERT DATE FROM STRING COLUMN 18 59
This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
In this article I will describe the Backup & Restore 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.

831 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