Posts

Showing posts from December, 2018

Quickly finding the Tables with specific Column Name in the Database.

While working with the database I find these queries very useful to locate correct Table or Columns when I only know the partial name of the column.

SELECT*  FROMINFORMATION_SCHEMA.COLUMNS  WHERE COLUMN_NAME LIKE'%Name%' 
SELECT*  FROMINFORMATION_SCHEMA.COLUMNS  WHERE TABLE_NAME like'%Name%' 
SELECT*  FROMINFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE  WHERE TABLE_NAME like'%Name%' 

Also if the naming conventions are followed then this will quickly give the list of the referring tables.