简体   繁体   中英

How to compare table schema on a database with an sql script file in C#?

Let say I have a table name Anonymous on a database and I have a file name Anonymous.sql on my harddrive. I want to know if the table's schema is as same as or difference from the schema define in Anonymous.sql . The sql file has a CREATE schema.

My questions are:

  1. How to compare a table's schema with a schema in an sql file?
  2. If they have any difference, how can I alter the table on the database?

If your table schema is in sql file, you can you beyond comparer software to compare those files.

And if you have any changes, change with that software and rerun the table schema in sql server with the prefix "alter table name"

for software download

http://beyond-compare.en.softonic.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM