Olugbnega Oyeneye
asked on
How can I find a table in SQL server 2016
How can I find a table in SQL server 2016.
I could use this to find the table in the current database:
SELECT *
FROM sys.Tables
WHERE name LIKE '%Application_Current_Sequ ence_Numbe r%'
The problem is, I have several databases on the server.
Kindly help.
I could use this to find the table in the current database:
SELECT *
FROM sys.Tables
WHERE name LIKE '%Application_Current_Sequ
The problem is, I have several databases on the server.
Kindly help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are you running in a SQL Server 2016 instance, right?
Is that instance Case Sensitive? If so, then write sys.tables in lower case:
Is that instance Case Sensitive? If so, then write sys.tables in lower case:
USE Master
GO
EXEC sp_MSforeachdb
@command1='use ?; SELECT *
FROM sys.tables
WHERE name LIKE ''%Application_Current_Sequence_Number%'''
ASKER
It works.
ASKER
Msg 208, Level 16, State 1, Line 3
Invalid object name 'sys.Tables'.