Link to home
Start Free TrialLog in
Avatar of Zack
ZackFlag for Australia

asked on

How to list the database name alongside the current corresponding query results

Heyas,

I have the following query:

DECLARE @command varchar(1000)
select @command = 'USE ?; select default_schema_name
, type_desc
, name
, create_date
from sys.database_principals
order by default_schema_name
, type_desc'
EXEC sp_MSforeachdb @command

Works fine.

My query is how to list the corresponding database for each of these existing result tests.

Any assistance is appreciated.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of chaau
chaau
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zack

ASKER

Thank you just saved me a few hrs :). If you are able can you offer any insight into this query:

https://www.experts-exchange.com/questions/28961401/Configuring-a-maintenance-plan-or-scheduled-jobs-to-via-rules-set-by-the-resource-governor-Error-OLE-DB-error-code-0x80040E4D-Login-failed-for-user-'SQL-RG-MP-User'.html 

I have scoured google but I can't any meaning insights into my query.