title: MS-SQL multiple like query
body: <p>I have two Input textboxes:-BookName and Author</p>
  
  <p>I am trying to use a store procedure for searching in Library Management System.
  Procedure is:</p>
  
  <pre><code>ALTER PROCEDURE dbo.Library_AdvSearch
      (
          @BookName varchar(50),
          @Author varchar(50)
  
      )
  AS
      Select * from Library_Book 
      where ( BookName Like '%'+ @BookName +'%' OR Author Like '%'+@Author+'%')
  
  RETURN
  </code></pre>
  
  <p>this produces an ambiguos result and displays all the data pertaining table</p>
  
  <p>now my question is: i want to redesign my query in such a way that if i dont insert any value in Bookname, and only define author, it should show me respective table entry</p>
  
  <p>my table looks like</p>
  
  <pre><code>BOOk name|Author
  C        |qwerty
  let us C |asdfg
  java     |xyz
  </code></pre>
  
  <p>now if i input only xyz ,it should display java and xyz in gridview</p>
  
  <p>so please help me in store procedure</p>
  
  <p>any help will be appreciated</p>