SQL Server Compare the Definitions of Two Tables

mspsb9vt  于 2023-06-04  发布在  其他
关注(0)|答案(1)|浏览(125)

Is there a way to compare programmatically in T-SQL the definitions of two tables.

Not only the column names and the data types, but all definitions that are returned by:

sp_help 'table_name'
x6h2sr28

x6h2sr281#

I would say best practice is to install Visual Studio, make a database project, import a source database into it, and then compare target databases to the database project. (All in Visual Studio)

Then you can also put the database project in source control if you want.

It uses the Sql Server Schema compare. Using that alone could also be a solution.

相关问题