I'm looking for a way to select all databases on my sql server, which only contain the table "dbo.mytable"
How can i do this ?
I already have these two sql queries :
Select name From sys.databases Where database_id > 5
And
IF EXISTS
    (SELECT * FROM sys.objects 
    WHERE object_id = OBJECT_ID(N'[dbo].[mytable]') AND type in (N'U')) 
  Select 1 [Exists]
Else
  Select 0 [Exists]
The first query, lists all databases on my sql server, and the second checks if dbo.mytable exists. I would like to merge them.
Thanks