Thursday, March 25, 2010

Multiple Seartch paremeter

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)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.