A friend was trying to create a quick comparison of two databases to find which tables had different schema designs. Here’s a quick way to do it in PowerShell. Clearly not as good as TableDiff or close to Red Gates SQL Data Compare

$db1 = invoke-sqlcmd -server "dev-ragnarok" -query "select * from tablecompare.INFORMATION_SCHEMA.COLUMNS"
$db2 = invoke-sqlcmd -server "dev-ragnarok" -query "select * from tablecompare2.INFORMATION_SCHEMA.COLUMNS"
$result = Compare-Object -DifferenceObject $DB1 -ReferenceObject $DB2
$result.InputObject | ft 
Advertisements