Sorry everyone. It appears that I am a dumbass! The query works fine when I run it against the live database versus my test database...gotta pay more attention to that stuff!
I am having a problem with the statement shown below. It works fine if I run it against one database (sans the DBCATALOG.dbo), so no problem there. When I try running the statement as is, I get an incorrect syntax near ‘<’. I also tried using a tool to create a union for all of our databases (see second statement). This results in an invalid object name error (Invalid object name 'TF7-User-Demo-ScheduledRestore-03.dbo.LinkedDocumentFolderTable', Invalid object name 'TF7-TestDatabase-ScheduledRestore.dbo.LinkedDocumentFolderTable', etc.). It seems to be tied to the .[dbo], but I just don’t know what causes the problem. I can’t find anything in the book stating a count can’t be performed across multiple databases….
SELECT CNT=COUNT(*)
FROM <DBCATALOG>.[dbo].[LinkedDocumentFolderTable]
WHERE IsUnmanagedFolder = 1
SELECT 'TF7-User-Demo-ScheduledRestore-03' AS DBCatalog, * FROM(SELECT COUNT(*)
FROM [TF7-User-Demo-ScheduledRestore-03].[dbo].[LinkedDocumentFolderTable]
WHERE IsUnmanagedFolder = 1)rsOne
UNION ALL
SELECT 'TF7-TestDatabase-ScheduledRestore' AS DBCatalog, * FROM(SELECT COUNT(*)
FROM [TF7-TestDatabase-ScheduledRestore].[dbo].[LinkedDocumentFolderTable]
WHERE IsUnmanagedFolder = 1)rsOne