Delete multiple SQL Server rows that have the same text snippet?

0

To test my forms, I ran several fills with the word "test" in the fields. Now I wanted to clean the DB, but I'm having trouble deleting multiple lines with the same stretch of "test" text

I am applying the following command, but no row is affected.

Delete FROM [DB_ControleDemandas].[dbo].[formulario] where Datas = '%Teste%'
    
asked by anonymous 18.12.2018 / 17:49

1 answer

4

Using the command described above is attempting to delete all lines with the text %Teste% . What you want here is to delete all rows that contain the 'Test' text, regardless of where it is placed. The command to use will be LIKE , as follows:

DELETE FROM [DB_ControleDemandas].[dbo].[formulario] WHERE Datas LIKE '%Teste%'
    
18.12.2018 / 18:18