USE AdventureWorks
GO
SELECT t.name AS table_name, SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%EmployeeID%'
ORDER BY schema_name, table_name;
Here's a working solution for a Sybase database
I don't know why so many of you suggesting Joining with
sys.table with sys.columns
you can simply use below code:Select object_name(object_id) as TableName,* from SYS.columns where name LIKE '%MyName%'
or
If you want schema name as well:
It is from Pinal Sir Blog
Following query will give you the exact table names of the database having field name like '%myName'.
I used this for the same purpose and it worked:
You can use
[INFORMATION_SCHEMA].[COLUMNS]
table to find columns Such asFor getting Table and Column information for given SQL statement visit http://www.w3hattrick.com/2016/05/getting-table-and-column-information.html