|
| Handy MSSQL script for comparing two tables |
| Iniciado por Walter VAN DER HORST, 03,oct. 2017 16:22 - No hay respuesta |
| |
| | | |
|
| |
Miembro registrado 1 mensaje |
|
| Publicado el 03,octubre 2017 - 16:22 |
Hi All , WD off course has its automatic table upgrade mechanism. But sometimes your stuck with different mssql tables that you want to compare (e.g. test and production environment). I want to share this script I found that compares the two structures and shows the differences (name, type , etc) nicely. It saved me lots of time.
SELECT DEV.name as DEV_ColumnName, PROD.name as PROD_ColumnName, DEV.is_nullable as DEV_is_nullable, PROD.is_nullable as PROD_is_nullable, DEV.system_type_name as DEV_Datatype, PROD.system_type_name as PROD_Datatype, DEV.is_identity_column as DEV_is_identity, PROD.is_identity_column as PROD_is_identity FROM sys.dm_exec_describe_first_result_set (N'SELECT * FROM Database1.dbo.WebUsers', NULL, 0) DEV FULL OUTER JOIN sys.dm_exec_describe_first_result_set (N'SELECT * FROM Database2.dbo.WebUsers2', NULL, 0) PROD ON DEV.name = PROD.name GO Best Regards
Walter (The Netherlands) |
| |
| |
| | | |
|
| | | | |
| | |
|