I want to search one table, and multiple columns using 1 variable. My code looks like this:
SELECT lCustomerID, sLastName, sFirstName, sAddress1, sAddress2,
sCity, sState, sZipcode , @search AS Expr1
FROM Customers
WHERE (sLastName = N'Includes @search')
OR (sFirstName = N'includes @search')
AND (sBarcode = N'includes @search')
I want it to include the string not =
Assuming you meant to have all ORs, and that “I want it to include the string” means you want a partial match (e.g. a search for “John” yields “Johnson” and “RoJohn”), you are looking for the LIKE keyword: