Ben (9/28/2007)
Exacxtly, though if you throw an 'or @companyName is null' in there the optimiser will ignore any 'parameters' that are not set.
Yes, I know about that (it's in Erland's article), and it is the best method. I left it out here to keep the example aligned with the article and keep the point clear.
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.