I know this has been asked in some contexts but I cannot follow how they are working. If there are plenty of useful answers to this question then just down vote me but please link the relevant questions before you do.
I am trying to write a query that will run in a batch file to automatically delete tables that have a specific string in their name. For example, when I run the batch file, I want it to look for tables that might have a ABCDir in the file. I have tried some various ways to get this to work with no success yet.
I know this is close to what I'm trying to do. Or I guess it could be way off lol.
DECLARE db_cursor CURSOR FOR
DELETE name FROM sys.database
WHERE name LIKE '%ABCDir%'