Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 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  
 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.02 seconds. Powered By: Snitz Forums 2000