In SQL Server how do you query a database to bring back all the tables that have a field of a specific name?
What is Schema in SQL? In a SQL database, a schema is a list of logical structures of data. A database user owns the schema, which has the same name as the database manager. As of SQL Server 2005, a schema is an individual entity (container of objects) distinct from the user who constructs the object.
Establishing Schema Version 1.0. 0.0. This is done by executing the ALTER_01_00. sql listed above (with database name set appropriately). Only after this script has been executed can we start using the versioning stored procedures.
In Management Studio, Click the "+" next to your database expanding the objects below it and click on "Tables" Open the Tables detail view by selecting "View" -> "Object Explorer Details" from the menu. Now select all tables (on the right hand side in the object details)
The following query will bring back a unique list of tables where Column_Name
is equal to the column you are looking for:
SELECT Table_Name
FROM INFORMATION_SCHEMA.COLUMNS
WHERE Column_Name = 'Desired_Column_Name'
GROUP BY Table_Name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With