DECLARE @tablename VARCHAR(30), @sql VARCHAR(500) DECLARE cur_delete_table CURSOR READ_ONLY FORWARD_ONLY FOR SELECT name FROM sysobjects WHERE name LIKE 'PUB%' AND type='U' OPEN cur_delete_table FETCH NEXT FROM cur_delete_table INTO @tablename WHILE @@FETCH_STATUS = 0 BEGIN SELECT @sql='drop table '+@tablename EXEC (@sql) FETCH NEXT FROM cur_delete_table INTO @tablename END CLOSE cur_delete_table DEALLOCATE cur_delete_table