title: Get all records in SQL depending on user input
body: <p>I am just learning SQL and came across a difficulty. My data table looks like this</p>
  
  <p><strong>DBO DATA</strong></p>
  
  <pre><code>Id | Name | Surname | Title  | Location
  ----------------------------------------
  1  | xxx  | abc     | def    | London
  2  | xxx  | abc     | def    | Oslo
  3  | xxx  | abc     | def    | New York
  </code></pre>
  
  <p>Now I want to get id, name, title and surname and I use query like this:</p>
  
  <pre><code>SELECT 
      Id, Name, Surname, Title 
  FROM 
      DATA 
  WHERE 
      Location = 'London' -- (this is user input)
  </code></pre>
  
  <p>But I get problem if the user inputs <code>All</code> or <code>World</code> or an empty string in <code>WHERE</code> clause, I want the query to return all rows. Is it possible to do this with writing another query to handle special scenarios like the above????</p>
  
  <p>I am using ASP.net with a datasource like this </p>
  
  <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" 
       ConnectionString="&lt;%$ ConnectionStrings:MainConnectionString %&gt;" 
       SelectCommand="SELECT [Name], [Id], [Surname], [Title] FROM [DATA] WHERE [Location] = @Location)" &gt;
     &lt;SelectParameters&gt;
         &lt;asp:ControlParameter ControlID="Label1" Name="Location" 
              PropertyName="Text" Type="String" /&gt;
     &lt;/SelectParameters&gt;
  &lt;/asp:SqlDataSource&gt;`
  </code></pre>
  
  <p>The input depends on the route path of URL <code>localhost:56789/People/London/</code></p>
  
  <p>The corresponding VB file is </p>
  
  <pre><code>Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
      If (Request.PathInfo.Length = 0) Then
  
      Else
          Dim t = Request.PathInfo.Substring(1)
          Label1.Text = t
      End If
  End Sub
  </code></pre>
  
  <p>I know I can do this application side but I am just curios if this is possible in query itself.</p>