views:

70

answers:

3

Good morning,

We are considering the possibility of upgrading from MSFT SQL 2000 to 2005. I am trying to run a windows file search on our code base, but it looks like searching for '*=' doesn't work right off the bat. Perhaps the * is some kind of wildcard?

Any help is appreciated, -Alan.

A: 

Get yourself a copy of Cygwin and use "real" search tools like grep :-) I've never trusted Windows search since I'm fairly certain it only searches within registered file types (although that may have changed since the last time I looked).

The command-line findstr seems to work better across all file types, so you can use something like:

findstr /s /l "*=" *.sql

in your top-level directory. The /s tells it to search all subdirectories and the /l means literal search. It can even do regular expressions if you're so inclined - run findstr /? from the command line for details.

paxdiablo
i just want to do a search, not ask the IT guys to install new stuff on my machine, which takes time.
AlanR
what he's saying is windows search will not do it. you WILL need to use another tool if you want this done reliably.
Robin Day
Windows search is severely broken. Even when searching for "normal" text inside ASCII text files, I've seen it not return results that were clearly there.
Adam Crume
+1  A: 

Where are your queries stored? If they're procedures in the database, no file-based search will help you. If they're in your client code, use the search feature in your IDE. If they're really in sql files on disk, that would seem very odd to me.

Joel Coehoorn
All of our procs are stored in subversion as files on the disk. That's the only way to make sure they are in source control. It's not really unusual.
HLGEM
A: 

To search for stored procs that contain the dreaded =* or *= you can use some variant of this

select  o.name,c.text
FROM yourdatabase..syscomments c(NOLOCK) 
     JOIN yourdatabase..sysobjects o(NOLOCK) ON c.id=o.id
where text like '%*=%' or text like '%=*%'

Replace your database name of course.

To expand on my comment earlier about how you need to find and fix whether you upgrade or not, SQL Server 2000 is broken when it comes to the use of =* or *=. SOmetimes it interpets them as outer joins and sometimes it intreprets them as cross joins which gives an entirely different result set. This behavior is so bad that it is not recomemended that this syntax ever be used in any verion of SQL server from 2000 on up (I can't speak for ealier versions)

HLGEM
not stored procedures.
AlanR