I have 100 databases from customers who all have the same schema but different content.
Now I wanted to some analysis and start out with running a distinct of one column over all databases. My instance contains these and more.
I think it is close to
EXEC sp_MSforeachdb 'Use ? select distinct [ColumName] from [TableName]'
However, that does not combine them; surrounding this with a
select also does not work.