• kyle.eldridge (9/23/2015)


    Hi,

    Not sure why the where is in there, thought I had removed that already, obviously not!

    a CTE would be fine to hold the table names, but this runs just fine as it is, I feel a CTE would overcomplicate things.

    I have run this on a server with over 180 databases and it returns instantly each time, if you wanted to limit what servers to query then you can always add it into a where clause, not sure what other use a CTE would have.

    appreciate the feedback and suggestion also 🙂

    You don't run it against 180 databases at the same time with the script you have posted here.

    Not unless you are executing the script 180 times which would never be instantaneous. or removed the database name from the where clause which would not be User databases only.

    However that does sound like a better idea for a troubleshooting tool.

    Just because I am logged into database Sales does not mean I cant open a transaction that affects data in the Accounting database.