I pose my problem. I have a SQL Server 2008 Database Server in which new databases are constantly being created, many of them are also being deleted and I don't have complete knowledge of how the log works, because I can actually see which databases have been deleted, but a while ago it stopped showing many, so I think the LOG is deleted or moved.
I would like a Dynamic SQL where I indicate by some variable or cursor, all the bases that I want to consult if they exist and that for each one I return the value "exists" or "does not exist".
I have nothing advanced since I can't think of how I could do it. I thought with some cursor along with a while, but I can't really think of it.
Any idea how I could?
You can use a temporary table to have the names of the databases and from this make a query that returns what you need,
with this you can make an SP or a script according to what you need.
I hope it helps you.
You can run this: