Previously, I published a script on comparing what tables two databases contained.  Going a bit further, I put together a script that compares the columns and what type of data they store.

Compare-DatabaseColumns has similar parameters to the Compare-DatabaseSchema script.

  • Table – One or more tables to compare columns from
  • SqlServerOne – SQL Server for the first database
  • FirstDatabase – Name of the first database for the comparison
  • SqlUsernameOne – SQL user name for the first database
  • SqlPasswordOne – SQL password for the first database
  • SqlServerTwo – SQL Server for the second database
  • SecondDatabase – Name of the second database for comparison
  • SqlUsernameTwo – SQL user name for the second database
  • SqlPasswordTwo – SQL password for the second database
  • FilePrefix – Prefix for the log file name
  • Log – Switch parameter that saves one CSV file with the difference in the tables.  If the Column switch parameter is chosen also, it will save one CSV file per table with differences in the columns

This script can also take pipeline input, either strings or a property of “Name” or “TableName”.

You can find this script on PoshCode.org.

Want more great reading? Check out my reading list!