Reputation: 73
I have a table with some columns and rows. I want to delete some rows contain specific data at specific row.
Ex: the table name is EXAM
I want to delete row 1 and row 3 when input condition string is C.
I did with the statement:
DELETE FROM EXAM
WHERE Comumn2 = 'C'
but only deleted Row 3.
Upvotes: 4
Views: 21252
Reputation: 93694
Another Way of doing it by using CharIndex
DELETE FROM EXAM WHERE CHARINDEX('C',Column2)>0
Upvotes: 0
Reputation: 62831
To match rows which contain a specific value, use LIKE
instead of =
:
DELETE FROM EXAM WHERE Column2 LIKE '%C%'
Upvotes: 8