Home > Blockchain >  searching all tables in DB containing specific column
searching all tables in DB containing specific column

Time:03-12

looking for a simple query to find all tables within a database that have a certain "id" column, confusing myself as not all the tables contain this "id"

CodePudding user response:

Using INFORMATION_SCHEMA.COLUMNS:

SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME = 'id'
  • Related