Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Brittney10
Posting Yak Master
154 Posts |
Posted - 2013-02-19 : 19:27:22
|
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. "My_File_Test_123434235.csv"would become..."My_File_Test.txt"I'm using a variable to rename the file, so this has to be done in an expression. Thanks for the help in advance. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-20 : 01:30:10
|
use expression like(FINDSTRING("Test",YourColumn,1)>0 ? SUBSTRING(YourColumn,1,FINDSTRING("Test",YourColumn,1)+3) + ".txt" : YourColumn)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|