Our application allows you to save any file type into the MS SQL DB as a blob/image. I now have to provide the feature to search for text within files. Similar to the standard Windows “find in files” search.
What is the best way of achieving this? I’ve used a StreamReader to read all text from the file and then used Regex to do a match. Just not sure if this is the most efficient way to search within files.
Thanks
You should look into SQL Server’s full text searching feature.
Here are some good articles:
I think you will find that trying to pull back many large records from the database and then searching them in memory to be quite inefficient. This is an area where your RDBMS excels, and if configured correctly, can make your life a lot simpler.