Новое сравнение настройки
Список исключенных из проверки различий в значениях по умолчанию пример
-- dbo; table1; col1; smallint; ; NOT_NULL; Not_Identity; ((123)); NULL; 7
-- dbo; table1; col1; smallint; ; NOT_NULL; Not_Identity; ((321)); NULL; 7
;[((123))].[((321))];[((123))].[((321))];

Список исключенных из проверки схем
Список исключенных из проверки таблиц
Список исключенных из проверки полей
Список исключенных из проверки элементов оканчивающихся на
Список исключенных из проверки элементов начинающихся на
Список исключенных из проверки наиманований элементов
для каждой базы выполните следующий запрос и вставьте значение из него в поле для каждого элемента



DECLARE @TMP_xml TABLE (sort int, vl xml); DECLARE @TMP_path TABLE ( dbpath nvarchar(256)); DECLARE @TMP_FP TABLE (type_desc NVARCHAR(256), name NVARCHAR(256), vfp nvarchar(max)); insert into @TMP_FP SELECT distinct o.type_desc , Schema_name(Schema_id)+'.'+OBJECT_NAME(Parent_object_id)+'.'+o.name AS name , (o.type_desc) collate SQL_Latin1_General_CP1_CI_AS+'#,#'+Schema_name(Schema_id)+'#,#'+('('+OBJECT_NAME(Parent_object_id)+')'+o.name) collate SQL_Latin1_General_CP1_CI_AS +'#,#'+CONVERT(VARCHAR(32) , HASHBYTES('MD5',CONVERT(VARchar(8000), SUBSTRING(reverse(SUBSTRING(Reverse(isnull(sm.[DEFINITION],'')), PATINDEX('%[A-z0-9]%', lower(REVERSE(isnull(sm.[DEFINITION],'')))), len(isnull(sm.[DEFINITION],'')))), CHARINDEX(lower(o.name), lower(isnull(sm.[DEFINITION],''))), len(isnull(sm.[DEFINITION],'')))) ) ,2) AS vfp FROM [sys].[objects] o INNER JOIN [sys].sql_modules sm ON o.object_id = sm.OBJECT_ID WHERE o.Type = 'TR' ORDER BY o.type_desc , Schema_name(Schema_id)+'.'+OBJECT_NAME(Parent_object_id)+'.'+o.name ; insert into @TMP_FP SELECT distinct o.type_desc,Schema_name(Schema_id)+'.'+so.name as name, (o.type_desc) collate SQL_Latin1_General_CP1_CI_AS+'#,#'+Schema_name(Schema_id)+'#,#'+(so.name) collate SQL_Latin1_General_CP1_CI_AS+'#,#'+CONVERT(VARCHAR(32) , HASHBYTES('MD5', CONVERT(VARchar(8000),SUBSTRING(reverse(SUBSTRING(Reverse(isnull(sr_r.ROUTINE_DEFINITION,'')), PATINDEX('%[A-z0-9]%', lower(REVERSE(isnull(sr_r.ROUTINE_DEFINITION,'')))), len(isnull(sr_r.ROUTINE_DEFINITION,'')))), CHARINDEX(lower(so.name), lower(isnull(sr_r.ROUTINE_DEFINITION,''))), len(isnull(sr_r.ROUTINE_DEFINITION,'')))) ) ,2) as vfp FROM [dbo].sysobjects so left JOIN [sys].objects o ON so.id=o.object_id left join INFORMATION_SCHEMA.ROUTINES sr_r on so.name = sr_r.ROUTINE_NAME WHERE so.type IN ('P', 'FN', 'IF', 'TF','V' ) ORDER BY o.type_desc , Schema_name(Schema_id)+'.'+so.name ; insert into @TMP_xml select 1, (select vfp from @TMP_FP FOR XML PATH('')) ; DECLARE @TMP_T TABLE (TABLE_SCHEMA NVARCHAR(256), TABLE_NAME NVARCHAR(256), ORDINAL_POSITION NVARCHAR(256),vt nvarchar(max)) insert into @TMP_T select distinct c.TABLE_SCHEMA, c.TABLE_NAME, ORDINAL_POSITION , c.TABLE_SCHEMA +'#,#'+c.TABLE_NAME +'#,#'+ COLUMN_NAME +'#,#'+ DATA_TYPE +'#,#'+ isnull(cast (CHARACTER_MAXIMUM_LENGTH as nvarchar(128)),' ') +'#,#'+ CAST(CASE c.IS_NULLABLE WHEN 'NO' THEN 'NOT_NULL' ELSE 'IS_NULL' END AS nvarchar(12)) +'#,#'+ CAST(CASE (COLUMNPROPERTY(OBJECT_ID('[' + c.TABLE_SCHEMA + '].[' + c.TABLE_NAME + ']') , c.COLUMN_NAME, 'IsIdentity')) WHEN '0' THEN 'Not_Identity' ELSE 'IsIdentity' END AS nvarchar(12)) +'#,#'+ isnull(cast (COLUMN_DEFAULT as nvarchar(1024)),'NULL') +'#,#'+ isnull(cast (COLLATION_NAME as nvarchar(128)),'NULL') +'#,#'+ cast (c.ORDINAL_POSITION as nvarchar(128)) as v from INFORMATION_SCHEMA.COLUMNS c join INFORMATION_SCHEMA.TABLES t on c.TABLE_NAME = t.TABLE_NAME WHERE t.TABLE_TYPE = 'BASE TABLE' AND t.TABLE_CATALOG=(SELECT db_name()) order by c.TABLE_SCHEMA ,c.TABLE_NAME , ORDINAL_POSITION; /* insert into @TMP_T SELECT distinct schema_name(st.schema_id) as TABLE_SCHEMA, st.name as TABLE_NAME ,sal.[column_id] as ORDINAL_POSITION, 'TT_'+ schema_name(st.schema_id) +'#,#'+st.name +'#,#'+ sal.[name] +'#,#'+ sst.name +'#,#'+ isnull(cast (sal.[max_length] as nvarchar(128)),' ') +'#,#'+ CAST(CASE sal.[is_nullable] WHEN '1' THEN 'NOT_NULL' ELSE 'IS_NULL' END AS nvarchar(12)) +'#,#'+ CAST(CASE ([is_identity]) WHEN '0' THEN 'Not_Identity' ELSE 'IsIdentity' END AS nvarchar(12)) +'#,#'+/*COLUMN_DEFAULT*/'NULL' +'#,#'+ isnull(cast (sal.[collation_name] as nvarchar(128)),'NULL') +'_'+ sao.name +'#,#'+ cast (sal.[column_id] as nvarchar(128)) as v FROM sys.all_columns sal join sys.all_objects sao on sao.object_id = sal.object_id left join sys.types st on sao.name like N'TT_'+st.name+'_%' left join sys.systypes sst on sal.system_type_id = sst.xtype where sao.type in ('TT') order by TABLE_SCHEMA ,TABLE_NAME , ORDINAL_POSITION; */ insert into @TMP_xml select 2,(select vt from @TMP_T FOR XML PATH('')) ; insert into @TMP_path values (''+(select @@servername+'\'+DB_NAME()+'->'+cast(getdate() as nvarchar(256) ) ) ); insert into @TMP_xml select 3,(select dbpath from @TMP_path FOR XML PATH('')) ; select vl from @TMP_xml order by sort FOR XML PATH(''); select * from @TMP_path;Select ('Схема базы ')





Сравнение таблиц, представлений, процедур и функций баз данных

Объект слева Обект справа заполнить по умолчанию