Tuesday, December 16, 2008

Getting Windows Search to work inside Code Files

Windows Search is a great tool, and the fact that you can search inside of documents for specific text helped me numerous times in college since I could generic search a folder of source information to find matches without having to actually scan (read) the documents myself.  You can see how to do this in the following image:


However, since I started with SQL I have never been able to get it to search inside of my .sql/.vb/.cs code files.  With the forums migration on MSDN today, I spent most of the day goofing around in the NNTP Newsgroups for SQL where someone asked about searching inside code files.  A quick google search turned up the following:

With Windows XP the default behaviour for searching within files will ignore .SQL files.

To get around this you can add a registry setting which will force Windows to treat .SQL files as text so it can search within the file.

  1. Open regedit
  2. Go to HKEY_CLASSES_ROOT\.sql
  3. Add a new key PersistentHandler
  4. Set the default value for the key to {5e941d80-bf96-11cd-b579-08002b30bfeb}

That’s it. You can do this for any other file type as well.

This information is thanks to the following blog post by Perry Stathopoulos:


I had to log out and log back in for it to take effect, but one of our developers didn't have the same issue, so if it doesn't work, give a logoff or reboot a shot.

No comments:

Post a Comment