Find-DbaSimilarTable

Returns all tables/views that are similar in structure by comparing the column names of matching and matched tables/views

This function can either run against specific databases or all databases searching all/specific tables and views including in system databases.
Typically one would use this to find for example archive version(s) of a table whose structures are similar.
This can also be used to find tables/views that are very similar to a given table/view structure to see where a table/view might be used.

More information can be found here: https://sqljana.wordpress.com/2017/03/31/sql-server-find-tables-with-similar-table-structure/

Screenshots

dbatools - Find-DbaSimilarTable

Examples

Searches all user database tables and views for each returns all tables or views with their matching tables/views and match percent

Find-DbaSimilarTable -SqlInstance DEV01

Searches AdventureWorks database and lists tables/views and their corresponding matching tables/views with match percent

Find-DbaSimilarTable -SqlInstance DEV01 -Database AdventureWorks

Searches AdventureWorks database and lists tables/views in the HumanResource schema with their corresponding matching tables/views with match percent

Find-DbaSimilarTable -SqlInstance DEV01 -Database AdventureWorks -SchemaName HumanResource

Searches AdventureWorks database and lists tables/views in the HumanResource schema and table Employee with its corresponding matching tables/views with match percent

Find-DbaSimilarTable -SqlInstance DEV01 -Database AdventureWorks -SchemaName HumanResource -Table Employee

Searches AdventureWorks database and lists all tables/views with its corresponding matching tables/views with match percent greater than or equal to 60

Find-DbaSimilarTable -SqlInstance DEV01 -Database AdventureWorks -MatchPercentThreshold 60

Author

This command was created by Jana Sattainathan. You can find Jana on Twitter and her blog.