title: filtering any columns of a database table client T-SQL select from case when then where
body: <p>I would like to be able filter through the columns of a datagrid but don't know how to fix the select statement this is as far as I could get  </p>
  
  <pre><code>SELECT 
      ClientID, FirstName, LastName, BirthDate, StreetName, 
      City, State, ZipCode, CellPhone 
  FROM 
      dbo.Client 
  CASE WHEN @ColumnName = 'ClientID' THEN WHERE @ColumnName = @Filter END
  CASE WHEN @ColumnName = 'FirstName' THEN WHERE @ColumnName LIKE @Filter END 
  CASE WHEN @ColumnName = 'LastName' THEN WHERE @ColumnName LIKE @Filter END 
  CASE WHEN @ColumnName = 'BirthDate' THEN WHERE @ColumnName = @Filter END 
  CASE WHEN @ColumnName = 'StreetName' THEN WHERE @ColumnName LIKE @Filter END 
  
  CASE WHEN @ColumnName = 'City' THEN WHERE @ColumnName LIKE @Filter END 
  CASE WHEN @ColumnName = 'State' THEN WHERE @ColumnName LIKE @Filter END 
  CASE WHEN @ColumnName = 'ZipCode' THEN WHERE @ColumnName LIKE @Filter END  
  CASE WHEN @ColumnName = 'CellPhone' THEN WHERE @ColumnName LIKE @Filter END;
  </code></pre>
  
  <p>Thank you for your time</p>