Here's the setup
@searchcondition varchar(50) --is a parameter passed into a stored procedure
IF(@searchconditions is null)
BEGIN
SET @searchcondition = '%'
END
ELSE
BEGIN
SET @searchcondtion = '%' + @searchcondition + '%'
END
select * from sometable
where somecolumn like @searchcondition
Now the procedure is fine if the user passes a string, but if it's null, it seems really inefficient to search for '%'. Is there a generalized approach, other than say putting slightly different versions of the query in an if block

Doing away with like '%%'
socko
Sharad_Sharma_2k
vb_jonas
Carolus.Holman
Did you already try the following:
select * from sometable
where (somecolumn like @searchcondition) or (@searchcondition is null)