SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

154 Posts

Posted - 02/19/2013 :  19:27:22  Show Profile  Reply with Quote
I need to do a find and replace on a file string. All of my files contain the word "Test" and i want to remove everything to right of "Test" and replace it with ".txt".

For example.


would become...


I'm using a variable to rename the file, so this has to be done in an expression.

Thanks for the help in advance.

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 02/20/2013 :  01:30:10  Show Profile  Reply with Quote
use expression like

(FINDSTRING("Test",YourColumn,1)>0 ? SUBSTRING(YourColumn,1,FINDSTRING("Test",YourColumn,1)+3) + ".txt" : YourColumn)

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000