user3449213
user3449213

Reputation: 17

Derived column to get date from filenanme not working as expected

I have a ssis package with flat file and oledb destination..

i need to get the date from file name and add it as new column in DB

but it is not working

I did this in derived column

SUBSTRING(@[User::OS_file],27,10) but it returns date when tried in sql-server

file name is like this

asjfbdsajfsd_21-08-2001_osss.log

i need 21-08-2001

how evere trying with SUBSTRING(@[User::OS_file],27,10) results me this

enter image description here

Upvotes: 0

Views: 105

Answers (1)

rory.ap
rory.ap

Reputation: 35318

Seems like you're using the wrong index in your SUBSTRING. It looks like it's pulling part of the path instead of part of the file name. What if you do this?

SUBSTRING(@[User::OS_file],50,10)

Note, I've changed the start index from 27 to 50.

Upvotes: 2

Related Questions