Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Script to compare tables in two databases

I need to compare two databases and find the tables that have different schema.

I don't need to compare the data. Company doesn't have Redgate. I Googled for a script and didn't find one.

Anyone has a script to find which tables have different schema?

I need to compare the stored procs too if there's a script for that.

If there's no script, I'll look into SQL Adpet (someone on the team mentioned it)
Avatar of Shareef Hiasat
Shareef Hiasat
Flag of Qatar image

Hi, your questions see to have many correct answers

I don't know sql microsoft but the concept stays the same in general, and can benefit you or others

One way, MySql example

I use below, i export the dbs then compare the dumps:

mysqldump -d -hlocalhost -uroot -p2pMTzGRlq6crf9MQTJud sajilni_v1 > /var/www/html/dump_v1.sql

mysqldump -d -hlocalhost -uroot -p2pMTzGRlq6crf9MQTJud sajilni_qa > /var/www/html/dump_qa.sql

diff -uP /var/www/html/dump_v1.sql /var/www/html/dump_qa.sql > /var/www/html/diff.txt

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

If it's free. Company won't pay for tools. Let me take a look.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'll take a look. Thanks
I think I'm in the right place?
1.I have VS 2019.
1. following this link https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sqlallproducts-allversions#ssdt-for-visual-studio-2019

I see this and got connected to my first database

User generated image