title: SQL: Getting Data from Multiple Columns using Where and Or
body: <p>I need to select the rows that contain keywords from multiple columns instead of one column such as:</p>
  
  <pre><code>"SELECT * From UserTable WHERE Name='" + name + "'" + " OR FullName='" + name + "'""
  </code></pre>
  
  <p>I want to select whichever row from MULTIPLE COLUMNS that contains the variable 'name'. However the above query doesn't work. What are the changes that should be done?</p>
  
  <p>If Name contains the value or if FullName contains the value or even if both contains the value, I would liek to get those rows :) The current query gives me an exception:</p>
  
  <pre><code>Incorrect syntax near the keyword 'FullName'.
  </code></pre>
  
  <p><strong>I tried this as well for another example:</strong></p>
  
  <pre><code>            SqlConnection cnn = new SqlConnection(conString);
  
              SqlCommand cmd = new SqlCommand("Select * from TheHive WHERE Variable=@variable or Group like @group", cnn);
              cmd.Parameters.Add("@Variable", SqlDbType.VarChar).Value = "wef";
              cmd.Parameters.Add("@Group", SqlDbType.VarChar).Value = "wef" + "%";
  
              cnn.Open();
              SqlDataReader rdr = cmd.ExecuteReader();
              while (rdr.Read())
              {
                  OpalData data = new OpalData();
                  data.ID = Convert.ToInt32(rdr["id"]);
                  data.CodeLine = rdr["CodeLine"].ToString();
                  data.Variable = rdr["Variable"].ToString();
                  data.Group = rdr["Group"].ToString();
                  data.Action = rdr["Action"].ToString();
                  data.Number = rdr["Number"].ToString();
  
                  knowledge.Add(data);
              }
  </code></pre>
  
  <p>And its Microsoft Azure table being:</p>
  
  <p><img src="https://i.stack.imgur.com/RCYLs.png" alt="enter image description here"></p>
  
  <p>I still get the same error.</p>
  
  <p>Where I'm just trying to find all the rows that has the string 'wef' and expect the output as all the rows since all rows contain 'wef' in at least one of their columns.</p>