When importing data I need to remove a set of characters from a string to allow comparison with a column. The database is 9.0.2, so regular expressions are not available (at least to my knowledge). Example:
String is 'A.628.164-09/11' My first approach was to loop over all characters of the original string, using CHARINDEX to determine if it is to be skipped. But I wonder, if there's a better solution. Any ideas? |
Reimer, a similar question can be found here (more in the question than in answers), as an example of using several nested REPLACE() calls, like Thomas has suggested. Comment Text Removed
1
I've used nested REPLACE-calls in some cases. For this one the string with chars to cut out should be a configurable string. So some kind of loop seems unavoidable to me. But I could try looping over the string with skip-chars calling REPLACE for each single-char substring and measure, which version well be faster with the customers data. Perhaps you can post your results. |