How to list the database name alongside the current corresponding query results
Posted on 2016-08-08
I have the following query:
DECLARE @command varchar(1000)
select @command = 'USE ?; select default_schema_name
order by default_schema_name
EXEC sp_MSforeachdb @command
My query is how to list the corresponding database for each of these existing result tests.
Any assistance is appreciated.