I am new to SQL Server.
I have a table name but I don't know where this particular table exists.
Could you please help me by giving the query to search entire server.
Note:- As I have to search 4 servers, each server have so many databases.
I can't search database level.
Kindly let me know the query which search entire server (all databases in server).
Thanks in advance,
You could use the undocumented & unsupported system procedure "sp_MSforeachdb" to go through all databases to execute a statement to search for the table, like:
EXEC sp_MSforeachdb N'SELECT [?] AS DbName, name AS TableName FROM [?].sys.tables WHERE name = ''MyTableName'''
Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.
Would you like to participate?