hariprasadraja
10/1/2019 - 4:10 PM

sql select column pattern

-- Find all the records that have "value" in any of the position
SELECT * FROM [table] WHERE [column] LIKE '%[value]%';


-- Find the match by starting with "val" and ending with "ue"
SELECT * FROM [table] WHERE [column] LIKE '[val_ue]';

/*
LIKE Operator 	Description
WHERE CustomerName LIKE 'a%' 	Finds any values that start with "a"
WHERE CustomerName LIKE '%a' 	Finds any values that end with "a"
WHERE CustomerName LIKE '%or%' 	Finds any values that have "or" in any position
WHERE CustomerName LIKE '_r%' 	Finds any values that have "r" in the second position
WHERE CustomerName LIKE 'a__%' 	Finds any values that start with "a" and are at least 3 characters in length
WHERE ContactName LIKE 'a%o' 	Finds any values that start with "a" and ends with "o"
*/