How to transform string date from a text file to SQL Server 2005?

SSIS way:

You can transform your string date through a Derived Column component to a new derived column with the Expression like: (Assume your date is in YYYYMMDD format)

(DT_DBTIMESTAMP)(SUBSTRING(mydate,5,2) + "/" + SUBSTRING(mydate,7,2) + "/" + SUBSTRING(mydate,1,4))

So, the whole process is:

(Under Data Flow Tab)

1. Drag a Flat File Source ;

2. Drag a Derived column and use DT_DBTIMESTAMP transformation with SUBSTRING manipulations; the derived column with a new table in SQL Server Destination.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s