I know people have been doing all sorts of things with T-SQL, and I have absolutely no issue with people trying to push the limit of what T-SQL can do, or what you can use it to accomplish, especially when it’s for demonstration or pedagogical purposes, or as an intellectual exercise. But then I bumped into an article on writing a T-SQL stored procedure to find and replace strings in a text file. That really unsettled me!
Sure, when you are in a hurry, you need to grab a tool--any tool--to get the job done, and T-SQL happens to be that tool immediately within the reach, go right ahead. But that doesn’t mean T-SQL is the right tool for the task of manipulating strings in a text file, or something worth recommending for that task.
In my opinion, T-SQL is not the right tool because there exist numerous other tools that are far better at dealing with strings in a text file.
Okay, what if T-SQL is the only way you know? Well, in that case I’m sorry! But why not invest some time in learning a text processing tool?
On the other hand, I’m always wary about saying something is terribly bad just because I’m ignorant or because of my narrow experience. I’m curious to learn if there is a good case out there for a T-SQL stored procedure for finding/replacing strings in a text file.