I am running a dynamic sql command with sp_msforeachdb for each database. However the command bombs for a certain database.
How is '?' used to display the database name when the error happens? I tried using it in a Catch statement but my syntax is wrong.