Skip to content
Advertisement

Drop Several Tables at Once

I have some tables that I need to drop on a regular basis. The names of the tables sometimes change but the table names always begin with ‘db_comp_temp’. Is it possible to write some SQL that will in effect do something like:

Thanks in advance,

Advertisement

Answer

No, there is no wildcard support in DDL.

Or:

You could also do it with FOR XML PATH but I don’t think it’s necessary when you’re not grouping the result into another outer query.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement