The following query:
DECLARE @command varchar(1000)
select @command = 'USE ?; select DB_NAME(), default_schema_name
order by default_schema_name
EXEC sp_MSforeachdb @command
Doesn't list all the database on the server I am running it on. I do get a one error message: Msg 911, Level 16, State 1, Line 1
Database 'Chris21PROD' does not exist. Make sure that the name is entered correctly.
How do make the query list all the databases in the server, any assistance is appreciated?