When ever you work on a search procedure with optional parameter,it will be helpful
Select col1,col2,.......coln from table_name where
(nullif(@col1,0) is null or(@col1>0 and col1 = @col1)
and (nullif(@col2,'') is null or col2=@col2)
and (nullif(@col3,'') is null or col3=@col3)
Thursday, March 25, 2010
Subscribe to:
Posts (Atom)