📜 ⬆️ ⬇️

Loading FIAS in DB on MSSQLSERVER with improvised (SQLXMLBULKLOAD) means. How it (probably) does not need to do

Epigraph:
"When you have a hammer in your hands, everything around seems like nails."


Once a long time ago, it seems - last Friday, bypassing the neighborhood of the office, the accursed bosses were preoccupied with the fact that I spend time in idleness and contemplation of cats and kittens.

- And if you do not download FIAS, friend sitny! - said the authorities. - For the process of loading something does not like our business units. For a long time, they say it loads, loads the grocery server, and the dude who wrote the loading process quit the other day, like three years already.
In addition, everything there needs to be redone for a long time, so you take it, create a base for yourself and ensure periodic filling of FIAS. Everything, as they say, do not delay!

Here I must say that I have a remote relationship with programming, since I am rather a DBA. Although, on the other hand, loading large arrays of previously prepared information is just the problem of the DBA, nest pa?
')
- Come on ... We’ll do it right now - I said to the authorities, and rushed to the FIAS site, rolling up my sleeves.

"ABOUT! Yes, there is dbf! ”- I thought, happily rubbing my hands, simultaneously marveling at the lack of a standard“ de facto ”zip archive, and, conversely, the presence of a long time deceased in Bose arj and proprietary pardon, open, of course, 7zip [but that is still cannot be decompressed using powershell Expand-Archive]. Those. pure powershell'om it can not be downloaded and unpacked. We'll have to pile on the server all the crap. Anyway.

The toolkit for mass parallel loading of dbf files has been written for me in a few years already, so problems should not arise.

I unpacked the dbfs, launched the boot program, and while the data was loading, I sketched a script that would glue the individual “almost-like” signs into one, according to their accessories.

I downloaded the data, and already wanted to go to the leadership office to reap, ts, laurels, but the devil pulled me to see the results of the import!



- Oops. WTF !!! ???



Large tables were loaded normally, and small tables contained cracks.

And so it became sad and depressing to me from all this that I courageously pulled myself together and engaged in procrastination and my direct duties. I didn’t want to mess around with broken dbf-kami.

I procrastinated for two days, until the applications ended, and the authorities again loomed on the horizon, with the sacramental question “What are we going to do?”.

And, since there was nothing to answer, and I still didn’t want to mess around with dbf, I decided to load FIAS from xml, especially since, as they say, it’s stylish, fashionable, youthful, and “dbf is a dying format”.
On this, allow the prolonged introductory monologue to end, and get to the point.

Epigraph 2:
Yes, it is also possible. :-)

So, it was decided to load c using SQLXMLBULKLOAD - a wonderful library, just designed for bulk (bulk) filling of structured xml files.
In order to use it, you need to download and install the library SqlXml 4.0 Service Pack 1 (SP1).

In the case of FIAS, however, “structuredness” is not particularly in demand. Because the files there are not that not xml ... they are, of course, xml, but, in fact, they are flat tables with data, in each file there is one table.

On the site sql.ru, I found the spXMLBulkLoad procedure by a respected Mnior user, in order not to get beyond the limits of the SQL server at all, and not even to write the SQLXMLBULKLOAD call to the CLR.

Here is a slightly modified version of it:

spXMLBulkLoad
USE [FIAS2] GO /****** Object: StoredProcedure [dbo].[spXMLBulkLoad] Script Date: 13.05.2019 18:05:58 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO --   Ole Automation Procedures: -- EXEC sp_configure 'Ole Automation Procedures', 1; RECONFIGURE WITH OVERRIDE; -- : -- EXEC dbo.spXMLBulkLoad 'Z:\Path\Data.xml','Z:\Path\Schema.xsd', 'FIAS', 'Z:\Path\error.xml' CREATE PROCEDURE [dbo].[spXMLBulkLoad] ( @File SysName ,@Schema SysName ,@DataBase SysName = '<DefaultDataBase>' ,@ErrorLog SysName ) AS BEGIN DECLARE @ErrCode Int ,@OLEXMLBulk Int ,@ErrMethod SysName ,@ErrDescript NVarChar(4000) EXEC @ErrCode = sys.sp_OACreate 'SQLXMLBulkLoad.SQLXMLBulkload', @OLEXMLBulk OUT IF (@ErrCode = 0) BEGIN SET @DataBase = 'Provider=SQLOLEDB;Data Source=.;DataBase=' + @DataBase + ';Integrated Security=SSPI' EXEC @ErrCode = sys.sp_OASetProperty @OLEXMLBulk ,'ConnectionString', @DataBase IF (@ErrCode <> 0) BEGIN SET @ErrMethod = 'ConnectionString' GOTO Error END EXEC @ErrCode = sys.sp_OASetProperty @OLEXMLBulk ,'ErrorLogFile', @ErrorLog IF (@ErrCode <> 0) BEGIN SET @ErrMethod = 'ErrorLogFile' GOTO Error END EXEC @ErrCode = sys.sp_OASetProperty @OLEXMLBulk, 'CheckConstraints', 1 IF (@ErrCode <> 0) BEGIN SET @ErrMethod = 'CheckConstraints' GOTO Error END --EXEC @ErrCode = sys.sp_OASetProperty @OLEXMLBulk, 'ForceTableLock', 1 -- IF (@ErrCode <> 0) -- BEGIN SET @ErrMethod = 'ForceTableLock' -- GOTO Error -- END EXEC @ErrCode = sys.sp_OAMethod @OLEXMLBulk, 'Execute', NULL, @Schema, @File IF (@ErrCode <> 0) BEGIN SET @ErrMethod = 'Execute' DECLARE @Exist Int ,@Error XML ,@SQL NvarChar(max) EXEC master.dbo.xp_FileExist @ErrorLog, @Exist OUT IF (@Exist = 1) BEGIN --  @ErrorLog  Set @SQL = N'SELECT @Error = E.Error + CASE WHEN Right(E.Error,1) <> ''>'' THEN ''lt>'' ELSE '''' END ' + N'FROM OPENROWSET(BULK '''+ @ErrorLog +''', SINGLE_NCLOB) E(Error)' exec sp_executesql @SQL, N'@Error xml OUTPUT', @Error=@Error OUTPUT SELECT @ErrDescript = IsNull(@ErrDescript,'') + E.Error.value('Description[1]','SysName') + ' ' FROM @Error.nodes('/Result/Error')E(Error) SELECT @ErrDescript = IsNull(@ErrDescript,'') + E.Error.value('Description[1]','SysName') + ' ' FROM @Error.nodes('/Error/Record')E(Error) END ELSE GOTO Error END GOTO Destroy Error: EXEC @ErrCode = sys.sp_OAGetErrorInfo @OLEXMLBulk, @ErrorLog OUT, @ErrDescript OUT Destroy: EXEC @ErrCode = sys.sp_OADestroy @OLEXMLBulk END ELSE SELECT @ErrMethod = 'SQLXMLBulkLoad.SQLXMLBulkload' ,@ErrorLog = 'sp_OACreate' ,@ErrDescript = '  OLE ' --   IF (@ErrMethod IS NOT NULL) BEGIN RAISERROR('    "%s"  "%s": %s',18,1, @ErrMethod, @ErrorLog, @ErrDescript) RETURN @@Error END END GO 


However, for the implementation of mass loading of xml using this library, annotated xsd schemes are needed, which, in fact, indicate how and where it loads.

There are references to the fact that there are such schemes, “but only old ones” - I found it already on a dozen sites, but I did not find the schemes anywhere. And got angry.

Modifying the existing scheme on the FIAS website for manually importing data is not difficult.
But ... in the aggregate - there are 271 fields! Well this is how much to sit and stupid necessary!

So I decided to modify these schemas automatically, at the same time and creating target tables in the database.

SQLXMLBULKLOAD is able to automatically create tables for loading data from an annotated schema, but, on the other hand, if I will do this schema, then why not make these tables myself the way I need it?

I downloaded the xsd schemes from the FIAS site and analyzed them purely visually.

Fortunately, they are all of the same type, so you can create a target database and modify the schemas themselves for loading using just a few not very complex queries.

1. Create an empty FIAS2 database.
Why "2"? Well, because “1” was a base from dbf-ok. Perhaps we will talk about her later.

The script to create a database FIAS2
 CREATE DATABASE [FIAS2] CONTAINMENT = NONE ON PRIMARY ( NAME = N'FIAS', FILENAME = N'E:\Data\FIAS1.mdf' , SIZE = 10485760KB , FILEGROWTH = 1048576KB ) LOG ON ( NAME = N'FIAS_log', FILENAME = N'E:\Data\FIAS1_log.ldf' , SIZE = 1048576KB , FILEGROWTH = 131072KB ) GO ALTER DATABASE [FIAS2] SET COMPATIBILITY_LEVEL = 120 GO ALTER DATABASE [FIAS2] SET ANSI_NULL_DEFAULT ON GO ALTER DATABASE [FIAS2] SET ANSI_NULLS ON GO ALTER DATABASE [FIAS2] SET ANSI_PADDING ON GO ALTER DATABASE [FIAS2] SET ANSI_WARNINGS ON GO ALTER DATABASE [FIAS2] SET ARITHABORT OFF GO ALTER DATABASE [FIAS2] SET AUTO_CLOSE OFF GO ALTER DATABASE [FIAS2] SET AUTO_SHRINK OFF GO ALTER DATABASE [FIAS2] SET AUTO_CREATE_STATISTICS ON(INCREMENTAL = OFF) GO ALTER DATABASE [FIAS2] SET AUTO_UPDATE_STATISTICS ON GO ALTER DATABASE [FIAS2] SET CURSOR_CLOSE_ON_COMMIT OFF GO ALTER DATABASE [FIAS2] SET CURSOR_DEFAULT GLOBAL GO ALTER DATABASE [FIAS2] SET CONCAT_NULL_YIELDS_NULL ON GO ALTER DATABASE [FIAS2] SET NUMERIC_ROUNDABORT OFF GO ALTER DATABASE [FIAS2] SET QUOTED_IDENTIFIER ON GO ALTER DATABASE [FIAS2] SET RECURSIVE_TRIGGERS OFF GO ALTER DATABASE [FIAS2] SET DISABLE_BROKER GO ALTER DATABASE [FIAS2] SET AUTO_UPDATE_STATISTICS_ASYNC OFF GO ALTER DATABASE [FIAS2] SET DATE_CORRELATION_OPTIMIZATION OFF GO ALTER DATABASE [FIAS2] SET PARAMETERIZATION SIMPLE GO ALTER DATABASE [FIAS2] SET READ_COMMITTED_SNAPSHOT ON GO ALTER DATABASE [FIAS2] SET READ_WRITE GO ALTER DATABASE [FIAS2] SET RECOVERY SIMPLE GO ALTER DATABASE [FIAS2] SET MULTI_USER GO ALTER DATABASE [FIAS2] SET PAGE_VERIFY CHECKSUM GO ALTER DATABASE [FIAS2] SET TARGET_RECOVERY_TIME = 0 SECONDS GO ALTER DATABASE [FIAS2] SET DELAYED_DURABILITY = DISABLED GO USE [FIAS2] GO IF NOT EXISTS (SELECT name FROM sys.filegroups WHERE is_default=1 AND name = N'PRIMARY') ALTER DATABASE [FIAS2] MODIFY FILEGROUP [PRIMARY] DEFAULT GO 


2. Create a couple of tablets in this database.

The first tablet will contain xsd schemes, and the second one will be actually a data scheme obtained from these xsd schemes.

The xsd schemas are actually regular xml files, so you can work with them as you would with regular xml files.

 USE [FIAS2] go if OBJECT_ID('dbo.[_FIAS]') is not null drop table dbo.[_FIAS] go if OBJECT_ID('dbo._FIAS_SCHEMAS') is not null drop table dbo.[_FIAS_SCHEMAS] go Create table dbo.[_FIAS_SCHEMAS] (x xml, [table] sysname) go --  :      ,   . insert into dbo.[_FIAS_SCHEMAS] (x, [table]) SELECT x = CAST(BulkColumn AS XML).query('.'), '_ACTSTAT' [table] FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ACTSTAT_2_250_08_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_ADDROBJ' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ADDROBJ_2_250_01_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_CENTERST' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_CENTERST_2_250_10_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_CURENTST' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_CURENTST_2_250_07_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_ADDROBJ' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_ADDROBJ_2_250_15_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_HOUSEINT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_HOUSEINT_2_250_17_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_HOUSE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_HOUSE_2_250_16_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_LANDMARK' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_LANDMARK_2_250_18_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_NORMDOC' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_NORMDOC_2_250_19_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_ESTSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ESTSTAT_2_250_13_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_FLATTYPE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_FLATTYPE_2_250_23_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_HOUSEINT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_HOUSEINT_2_250_03_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_HOUSE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_HOUSE_2_250_02_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_HSTSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_HSTSTAT_2_250_12_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_INTVSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_INTVSTAT_2_250_11_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_LANDMARK' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_LANDMARK_2_250_04_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_NDOCTYPE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_NDOCTYPE_2_250_20_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_NORMDOC' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_NORMDOC_2_250_05_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_OPERSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_OPERSTAT_2_250_09_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_ROOMTYPE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ROOMTYPE_2_250_24_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_ROOM' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ROOM_2_250_21_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_SOCRBASE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_SOCRBASE_2_250_06_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_STEAD' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_STEAD_2_250_22_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_STRSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_STRSTAT_2_250_14_04_01_01.xsd', SINGLE_BLOB) x --  :  ,       ;WITH XMLNAMESPACES ('http://www.w3.org/2001/XMLSchema' as xs) Select a.[table] ,tbl.[root_name] ,tbl.[root_description] ,tbl.[name] ,ROW_NUMBER() over (partition by a.[table] order by 1/0) N ,tbl.[column] ,tbl.[required] ,tbl.[description] ,tbl.[type] ,tbl.[len] ,Case tbl.[type] when N'byte' then N'tinyint' when N'date' then N'date' when N'int' then N'int' when N'string' then Case when tbl.[len] = 36 and (tbl.[column] like N'%ID' or tbl.[column] = N'NORMDOC') then N'uniqueidentifier' when tbl.[len] is Null then N'nvarchar(max)' Else N'nvarchar(' + cast(tbl.[len] as nvarchar(4000)) + N')' END when N'integer' then Case when tbl.[len] > 9 then N'bigint' when tbl.[len] <= 4 then N'smallint' Else N'int' end else N'nvarchar(max)' End [sqltype] ,tnquery('.') [node] into dbo.[_FIAS] from dbo.[_FIAS_SCHEMAS] a Cross apply axnodes('//xs:attribute') t(n) Cross apply (values --     ,    :) ( x.value('(xs:schema[1]/xs:element[1]/@name)', 'nvarchar(255)') ,x.value('(xs:schema[1]/xs:element[1]/xs:annotation/xs:documentation[1]/text())[1]', 'nvarchar(4000)') ,x.value('(xs:schema[1]/xs:element[1]/xs:complexType[1]/xs:sequence[1]/xs:element[1]/@name)', 'nvarchar(255)') ,tnvalue('(./@name)[1]', 'nvarchar(255)') ,tnvalue('(./@use)[1]', 'nvarchar(255)') ,Stuff(Coalesce(tnvalue('(./xs:simpleType/xs:restriction/@base)[1]', 'nvarchar(255)'), tnvalue('(./@type)[1]', 'nvarchar(255)')), 1, 3, '') ,Coalesce(tnvalue('(./xs:simpleType/xs:restriction/xs:length/@value)[1]', 'int') ,tnvalue('(./xs:simpleType/xs:restriction/xs:maxLength/@value)[1]', 'int') ,tnvalue('(./xs:simpleType/xs:restriction/xs:totalDigits/@value)[1]', 'int')) ,Replace( Replace( Replace( Replace( Replace( Replace( Replace( Replace( Replace(tnvalue('(./xs:annotation/xs:documentation)[1]', 'nvarchar(4000)'), ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') ) ) tbl([root_name], [root_description], [name], [column], [required], [type], [len], [description]) --    Select * from dbo.[_FIAS] 

More details on requests:

The first one loads the xsd schema into a table on the server, simultaneously annotating each schema in the [table] field with the name of the table into which I want to load data from the corresponding table.

Of course, it would be possible to make it so that each time the charts change, they could be downloaded, put into a folder and recreated the structure of the target tables anew and automatically, and again and automatically modified the charts, but .to. the structure changes extremely rarely, the last time it changed - already in the 16th year - to make such an automatic machine is extremely lazy. It is better to spend 30 seconds on CTRL + C - CTRL + V.

Therefore, the loading in the table with the diagrams is so hard, and the paths to the downloaded files, as well as the names of the tables, are written by hand.

The second query pulls information about the structure of tables from the schemas. I did not bother with 3-nf, but expanded it as one table.

Pay attention to this piece (+) by the way.

Quite often, newbies ask a question: is it possible to calculate a complex expression in a query 1 time, and then reuse it in several places. Yes you can. So, for example:

 from dbo.[_FIAS_SCHEMAS] a Cross apply axnodes('//xs:attribute') t(n) Cross apply (values --     ,    :) ( x.value('(xs:schema[1]/xs:element[1]/@name)', 'nvarchar(255)') , ...      ,         ) ) tbl([root_name], [root_description], [name], [column], [required], [type], [len], [description]) 

Works with some limitations, of course. But, having started to use, you will quickly understand what they are.

3. Create scripts that create FIAS tables, and then run them, and create the tables themselves:

 Declare @schema sysname = N'dbo' Declare @sql nvarchar(max) --     ,    set @sql = ( Select Distinct N';Create table ' + Quotename(@schema) + N'.' + Quotename([table]) + N'(' + Stuff((Select N',' + QUOTENAME(b.[column]) + N' ' + b.[sqltype] + Case b.[required] when 'required' then N' NOT NULL' when 'optional' then N' NULL' End From dbo.[_FIAS] b where b.[table] = a.[table] Order by N ASC For xml path(N''), type ).value(N'.', 'nvarchar(max)'), 1, 1, N'') + N')' from dbo.[_FIAS] a For xml path(N''), type).value(N'.', N'nvarchar(max)') exec (@sql) 

Those who are too lazy to do all this - the scripts for creating tables and the annotated FIAS schemes will be attached at the end of the article.

Request to create tables, which was the result of the query
 ; CREATE TABLE [dbo].[_ACTSTAT] ( [NAME] NVARCHAR(100) NOT NULL ,[ACTSTATID] BIGINT NOT NULL ); CREATE TABLE [dbo].[_ADDROBJ] ( [AOGUID] UNIQUEIDENTIFIER NOT NULL ,[FORMALNAME] NVARCHAR(120) NOT NULL ,[REGIONCODE] NVARCHAR(2) NOT NULL ,[AUTOCODE] NVARCHAR(1) NOT NULL ,[AREACODE] NVARCHAR(3) NOT NULL ,[CITYCODE] NVARCHAR(3) NOT NULL ,[CTARCODE] NVARCHAR(3) NOT NULL ,[PLACECODE] NVARCHAR(3) NOT NULL ,[PLANCODE] NVARCHAR(4) NOT NULL ,[STREETCODE] NVARCHAR(4) NULL ,[EXTRCODE] NVARCHAR(4) NOT NULL ,[SEXTCODE] NVARCHAR(3) NOT NULL ,[OFFNAME] NVARCHAR(120) NULL ,[POSTALCODE] NVARCHAR(6) NULL ,[IFNSFL] NVARCHAR(4) NULL ,[TERRIFNSFL] NVARCHAR(4) NULL ,[IFNSUL] NVARCHAR(4) NULL ,[TERRIFNSUL] NVARCHAR(4) NULL ,[OKATO] NVARCHAR(11) NULL ,[UPDATEDATE] DATE NOT NULL ,[SHORTNAME] NVARCHAR(10) NOT NULL ,[AOLEVEL] BIGINT NOT NULL ,[PARENTGUID] UNIQUEIDENTIFIER NULL ,[AOID] UNIQUEIDENTIFIER NOT NULL ,[PREVID] UNIQUEIDENTIFIER NULL ,[NEXTID] UNIQUEIDENTIFIER NULL ,[CODE] NVARCHAR(17) NULL ,[PLAINCODE] NVARCHAR(15) NULL ,[ACTSTATUS] BIGINT NOT NULL ,[CENTSTATUS] BIGINT NOT NULL ,[OPERSTATUS] BIGINT NOT NULL ,[CURRSTATUS] BIGINT NOT NULL ,[STARTDATE] DATE NOT NULL ,[ENDDATE] DATE NOT NULL ,[NORMDOC] UNIQUEIDENTIFIER NULL ,[LIVESTATUS] TINYINT NOT NULL ,[DIVTYPE] INT NOT NULL ,[OKTMO] NVARCHAR(11) NULL ); CREATE TABLE [dbo].[_CENTERST] ( [CENTERSTID] BIGINT NOT NULL ,[NAME] NVARCHAR(100) NOT NULL ); CREATE TABLE [dbo].[_CURENTST] ( [CURENTSTID] BIGINT NOT NULL ,[NAME] NVARCHAR(100) NOT NULL ); CREATE TABLE [dbo].[_DEL_ADDROBJ] ( [AOGUID] UNIQUEIDENTIFIER NOT NULL ,[FORMALNAME] NVARCHAR(120) NOT NULL ,[REGIONCODE] NVARCHAR(2) NOT NULL ,[AUTOCODE] NVARCHAR(1) NOT NULL ,[AREACODE] NVARCHAR(3) NOT NULL ,[CITYCODE] NVARCHAR(3) NOT NULL ,[CTARCODE] NVARCHAR(3) NOT NULL ,[PLACECODE] NVARCHAR(3) NOT NULL ,[STREETCODE] NVARCHAR(4) NULL ,[EXTRCODE] NVARCHAR(4) NOT NULL ,[PLANCODE] NVARCHAR(4) NOT NULL ,[SEXTCODE] NVARCHAR(3) NOT NULL ,[OFFNAME] NVARCHAR(120) NULL ,[POSTALCODE] NVARCHAR(6) NULL ,[SHORTNAME] NVARCHAR(10) NOT NULL ,[AOLEVEL] BIGINT NOT NULL ,[PARENTGUID] UNIQUEIDENTIFIER NULL ,[AOID] UNIQUEIDENTIFIER NOT NULL ,[PREVID] UNIQUEIDENTIFIER NULL ,[NEXTID] UNIQUEIDENTIFIER NULL ,[CODE] NVARCHAR(17) NULL ,[PLAINCODE] NVARCHAR(15) NULL ,[ACTSTATUS] BIGINT NOT NULL ,[CENTSTATUS] BIGINT NOT NULL ,[OPERSTATUS] BIGINT NOT NULL ,[CURRSTATUS] BIGINT NOT NULL ,[STARTDATE] DATE NOT NULL ,[ENDDATE] DATE NOT NULL ,[NORMDOC] UNIQUEIDENTIFIER NULL ,[LIVESTATUS] TINYINT NOT NULL ,[IFNSFL] NVARCHAR(4) NULL ,[TERRIFNSFL] NVARCHAR(4) NULL ,[IFNSUL] NVARCHAR(4) NULL ,[TERRIFNSUL] NVARCHAR(4) NULL ,[OKATO] NVARCHAR(11) NULL ,[OKTMO] NVARCHAR(11) NULL ,[UPDATEDATE] DATE NOT NULL ); CREATE TABLE [dbo].[_DEL_HOUSE] ( [POSTALCODE] NVARCHAR(6) NULL ,[IFNSFL] NVARCHAR(4) NULL ,[TERRIFNSFL] NVARCHAR(4) NULL ,[IFNSUL] NVARCHAR(4) NULL ,[TERRIFNSUL] NVARCHAR(4) NULL ,[OKATO] NVARCHAR(11) NULL ,[OKTMO] NVARCHAR(11) NULL ,[UPDATEDATE] DATE NOT NULL ,[HOUSENUM] NVARCHAR(20) NULL ,[ESTSTATUS] SMALLINT NOT NULL ,[BUILDNUM] NVARCHAR(10) NULL ,[STRUCNUM] NVARCHAR(10) NULL ,[STRSTATUS] BIGINT NULL ,[HOUSEID] UNIQUEIDENTIFIER NOT NULL ,[HOUSEGUID] UNIQUEIDENTIFIER NOT NULL ,[AOGUID] UNIQUEIDENTIFIER NOT NULL ,[STARTDATE] DATE NOT NULL ,[ENDDATE] DATE NOT NULL ,[STATSTATUS] BIGINT NOT NULL ,[NORMDOC] UNIQUEIDENTIFIER NULL ,[COUNTER] BIGINT NOT NULL ,[CADNUM] NVARCHAR(100) NULL ,[DIVTYPE] INT NOT NULL ); CREATE TABLE [dbo].[_DEL_HOUSEINT] ( [IFNSUL] NVARCHAR(4) NULL ,[TERRIFNSUL] NVARCHAR(4) NULL ,[OKATO] NVARCHAR(11) NULL ,[OKTMO] NVARCHAR(11) NULL ,[UPDATEDATE] DATE NOT NULL ,[INTSTART] BIGINT NOT NULL ,[INTEND] BIGINT NOT NULL ,[POSTALCODE] NVARCHAR(6) NULL ,[IFNSFL] NVARCHAR(4) NULL ,[TERRIFNSFL] NVARCHAR(4) NULL ,[HOUSEINTID] UNIQUEIDENTIFIER NOT NULL ,[INTGUID] UNIQUEIDENTIFIER NOT NULL ,[AOGUID] UNIQUEIDENTIFIER NOT NULL ,[STARTDATE] DATE NOT NULL ,[ENDDATE] DATE NOT NULL ,[INTSTATUS] BIGINT NOT NULL ,[NORMDOC] UNIQUEIDENTIFIER NULL ,[COUNTER] BIGINT NOT NULL ); CREATE TABLE [dbo].[_DEL_LANDMARK] ( [LOCATION] NVARCHAR(500) NOT NULL ,[POSTALCODE] NVARCHAR(6) NULL ,[IFNSFL] NVARCHAR(4) NULL ,[TERRIFNSFL] NVARCHAR(4) NULL ,[IFNSUL] NVARCHAR(4) NULL ,[TERRIFNSUL] NVARCHAR(4) NULL ,[OKATO] NVARCHAR(11) NULL ,[OKTMO] NVARCHAR(11) NULL ,[UPDATEDATE] DATE NOT NULL ,[LANDID] UNIQUEIDENTIFIER NOT NULL ,[LANDGUID] UNIQUEIDENTIFIER NOT NULL ,[AOGUID] UNIQUEIDENTIFIER NOT NULL ,[STARTDATE] DATE NOT NULL ,[ENDDATE] DATE NOT NULL ,[NORMDOC] UNIQUEIDENTIFIER NULL ); CREATE TABLE [dbo].[_DEL_NORMDOC] ( [NORMDOCID] UNIQUEIDENTIFIER NOT NULL ,[DOCNAME] NVARCHAR(max) NULL ,[DOCDATE] DATE NULL ,[DOCNUM] NVARCHAR(20) NULL ,[DOCTYPE] BIGINT NOT NULL ,[DOCIMGID] UNIQUEIDENTIFIER NULL ); CREATE TABLE [dbo].[_ESTSTAT] ( [ESTSTATID] BIGINT NOT NULL ,[NAME] NVARCHAR(20) NOT NULL ,[SHORTNAME] NVARCHAR(20) NULL ); CREATE TABLE [dbo].[_FLATTYPE] ( [SHORTNAME] NVARCHAR(20) NULL ,[FLTYPEID] BIGINT NOT NULL ,[NAME] NVARCHAR(20) NOT NULL ); CREATE TABLE [dbo].[_HOUSE] ( [POSTALCODE] NVARCHAR(6) NULL ,[REGIONCODE] NVARCHAR(2) NULL ,[IFNSFL] NVARCHAR(4) NULL ,[TERRIFNSFL] NVARCHAR(4) NULL ,[IFNSUL] NVARCHAR(4) NULL ,[TERRIFNSUL] NVARCHAR(4) NULL ,[OKATO] NVARCHAR(11) NULL ,[OKTMO] NVARCHAR(11) NULL ,[UPDATEDATE] DATE NOT NULL ,[HOUSENUM] NVARCHAR(20) NULL ,[ESTSTATUS] SMALLINT NOT NULL ,[BUILDNUM] NVARCHAR(10) NULL ,[STRUCNUM] NVARCHAR(10) NULL ,[STRSTATUS] BIGINT NULL ,[HOUSEID] UNIQUEIDENTIFIER NOT NULL ,[HOUSEGUID] UNIQUEIDENTIFIER NOT NULL ,[AOGUID] UNIQUEIDENTIFIER NOT NULL ,[STARTDATE] DATE NOT NULL ,[ENDDATE] DATE NOT NULL ,[STATSTATUS] BIGINT NOT NULL ,[NORMDOC] UNIQUEIDENTIFIER NULL ,[COUNTER] BIGINT NOT NULL ,[CADNUM] NVARCHAR(100) NULL ,[DIVTYPE] INT NOT NULL ); CREATE TABLE [dbo].[_HOUSEINT] ( [OKTMO] NVARCHAR(11) NULL ,[OKATO] NVARCHAR(11) NULL ,[IFNSUL] NVARCHAR(4) NULL ,[TERRIFNSUL] NVARCHAR(4) NULL ,[TERRIFNSFL] NVARCHAR(4) NULL ,[POSTALCODE] NVARCHAR(6) NULL ,[IFNSFL] NVARCHAR(4) NULL ,[ENDDATE] DATE NOT NULL ,[INTSTATUS] BIGINT NOT NULL ,[AOGUID] UNIQUEIDENTIFIER NOT NULL ,[STARTDATE] DATE NOT NULL ,[INTGUID] UNIQUEIDENTIFIER NOT NULL ,[HOUSEINTID] UNIQUEIDENTIFIER NOT NULL ,[INTSTART] BIGINT NOT NULL ,[INTEND] BIGINT NOT NULL ,[UPDATEDATE] DATE NOT NULL ,[NORMDOC] UNIQUEIDENTIFIER NULL ,[COUNTER] BIGINT NOT NULL ); CREATE TABLE [dbo].[_HSTSTAT] ( [HOUSESTID] BIGINT NOT NULL ,[NAME] NVARCHAR(60) NOT NULL ); CREATE TABLE [dbo].[_INTVSTAT] ( [INTVSTATID] BIGINT NOT NULL ,[NAME] NVARCHAR(60) NOT NULL ); CREATE TABLE [dbo].[_LANDMARK] ( [NORMDOC] UNIQUEIDENTIFIER NULL ,[STARTDATE] DATE NOT NULL ,[ENDDATE] DATE NOT NULL ,[LANDGUID] UNIQUEIDENTIFIER NOT NULL ,[AOGUID] UNIQUEIDENTIFIER NOT NULL ,[LANDID] UNIQUEIDENTIFIER NOT NULL ,[LOCATION] NVARCHAR(500) NOT NULL ,[POSTALCODE] NVARCHAR(6) NULL ,[TERRIFNSFL] NVARCHAR(4) NULL ,[IFNSFL] NVARCHAR(4) NULL ,[UPDATEDATE] DATE NOT NULL ,[OKTMO] NVARCHAR(11) NULL ,[OKATO] NVARCHAR(11) NULL ,[IFNSUL] NVARCHAR(4) NULL ,[TERRIFNSUL] NVARCHAR(4) NULL ); CREATE TABLE [dbo].[_NDOCTYPE] ( [NDTYPEID] BIGINT NOT NULL ,[NAME] NVARCHAR(250) NOT NULL ); CREATE TABLE [dbo].[_NORMDOC] ( [NORMDOCID] UNIQUEIDENTIFIER NOT NULL ,[DOCNAME] NVARCHAR(max) NULL ,[DOCDATE] DATE NULL ,[DOCNUM] NVARCHAR(20) NULL ,[DOCTYPE] BIGINT NOT NULL ,[DOCIMGID] UNIQUEIDENTIFIER NULL ); CREATE TABLE [dbo].[_OPERSTAT] ( [OPERSTATID] BIGINT NOT NULL ,[NAME] NVARCHAR(100) NOT NULL ); CREATE TABLE [dbo].[_ROOM] ( [ROOMGUID] UNIQUEIDENTIFIER NOT NULL ,[FLATNUMBER] NVARCHAR(50) NOT NULL ,[FLATTYPE] INT NOT NULL ,[ROOMNUMBER] NVARCHAR(50) NULL ,[ROOMTYPE] INT NULL ,[REGIONCODE] NVARCHAR(2) NOT NULL ,[POSTALCODE] NVARCHAR(6) NULL ,[UPDATEDATE] DATE NOT NULL ,[HOUSEGUID] UNIQUEIDENTIFIER NOT NULL ,[ROOMID] UNIQUEIDENTIFIER NOT NULL ,[PREVID] UNIQUEIDENTIFIER NULL ,[NEXTID] UNIQUEIDENTIFIER NULL ,[STARTDATE] DATE NOT NULL ,[ENDDATE] DATE NOT NULL ,[LIVESTATUS] TINYINT NOT NULL ,[NORMDOC] UNIQUEIDENTIFIER NULL ,[OPERSTATUS] BIGINT NOT NULL ,[CADNUM] NVARCHAR(100) NULL ,[ROOMCADNUM] NVARCHAR(100) NULL ); CREATE TABLE [dbo].[_ROOMTYPE] ( [SHORTNAME] NVARCHAR(20) NULL ,[NAME] NVARCHAR(20) NOT NULL ,[RMTYPEID] BIGINT NOT NULL ); CREATE TABLE [dbo].[_SOCRBASE] ( [LEVEL] BIGINT NOT NULL ,[SCNAME] NVARCHAR(10) NULL ,[SOCRNAME] NVARCHAR(50) NOT NULL ,[KOD_T_ST] NVARCHAR(4) NOT NULL ); CREATE TABLE [dbo].[_STEAD] ( [STEADGUID] UNIQUEIDENTIFIER NOT NULL ,[NUMBER] NVARCHAR(120) NULL ,[REGIONCODE] NVARCHAR(2) NOT NULL ,[POSTALCODE] NVARCHAR(6) NULL ,[IFNSFL] NVARCHAR(4) NULL ,[TERRIFNSFL] NVARCHAR(4) NULL ,[IFNSUL] NVARCHAR(4) NULL ,[TERRIFNSUL] NVARCHAR(4) NULL ,[OKATO] NVARCHAR(11) NULL ,[OKTMO] NVARCHAR(11) NULL ,[UPDATEDATE] DATE NOT NULL ,[PARENTGUID] UNIQUEIDENTIFIER NULL ,[STEADID] UNIQUEIDENTIFIER NOT NULL ,[PREVID] UNIQUEIDENTIFIER NULL ,[NEXTID] UNIQUEIDENTIFIER NULL ,[OPERSTATUS] BIGINT NOT NULL ,[STARTDATE] DATE NOT NULL ,[ENDDATE] DATE NOT NULL ,[NORMDOC] UNIQUEIDENTIFIER NULL ,[LIVESTATUS] TINYINT NOT NULL ,[CADNUM] NVARCHAR(100) NULL ,[DIVTYPE] INT NOT NULL ); CREATE TABLE [dbo].[_STRSTAT] ( [NAME] NVARCHAR(20) NOT NULL ,[SHORTNAME] NVARCHAR(20) NULL ,[STRSTATID] BIGINT NOT NULL ) 


4. Since xsd has a normal description of the tables and fields in them - use it, and create a description of the structure in the advanced properties of the tables and their fields:

 --       Set @sql = ( Select N'; exec sp_addextendedproperty @name=''description'', @value=N''' + a.[root_description] + N''', @level0type =N''Schema'', @level0name = N''' + @schema + N''', @level1type = N''Table'', @level1name = N''' + a.[table] + N'''' from (Select distinct [table], [root_description] from dbo.[_FIAS]) a for xml path(N''), type ).value(N'.', N'nvarchar(max)') exec (@sql) Set @sql = ( Select N'; exec sp_addextendedproperty @name=''description'', @value=N''' + a.[description] + N''', @level0type =N''Schema'', @level0name = N''' + @schema + N''', @level1type = N''Table'', @level1name = N''' + a.[table] + N''', @level2type = N''Column'', @level2name = N''' + a.[column] + N'''' from dbo.[_FIAS] a for xml path(N''), type ).value(N'.', N'nvarchar(max)') exec (@sql) 

Here is the code that is obtained and executed as a result
 ; EXEC sp_addextendedproperty @name = 'description' ,@value = N'           ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ACTSTAT'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'          ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'           ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_CENTERST'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'          4.0   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_CURENTST'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'          ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'             ,     .   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'           ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'              ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'          ,         ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'           ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ESTSTAT'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'           ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_FLATTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'                ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'           ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'            ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HSTSTAT'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'            ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_INTVSTAT'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'              ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'            ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NDOCTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'          ,         ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'           ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_OPERSTAT'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'       ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'           ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOMTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'            ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_SOCRBASE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'        ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'           ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STRSTAT' ; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AOGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'FORMALNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'REGIONCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AUTOCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AREACODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CITYCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CTARCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PLACECODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PLANCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'STREETCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'EXTRCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'SEXTCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'OFFNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'IFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'TERRIFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'IFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'TERRIFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKATO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'OKATO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'SHORTNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AOLEVEL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PARENTGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  .  .' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AOID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'      ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PREVID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'      ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'NEXTID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'          4.0. ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     4.0      (  )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PLAINCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    .     .      . 0 –   1 -  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'ACTSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CENTSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    –    (.   OperationStatus): 01 – ; 10 – ; 20 – ; 21 –  ; 30 – ; 31 -     ; 40 –    (); 41 –     ; 42 -        ; 43 -         ; 50 – ; 51 –     ; 60 –    ; 61 –        ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'OPERSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   4 (    )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CURRSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'LIVESTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  : 0 -   1 - ; 2 - - ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'DIVTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKTMO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'OKTMO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ()' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_CURENTST' ,@level2type = N'Column' ,@level2name = N'CURENTSTID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' (0 - , 1-50, 2-98 –  ( 51), 51 - , 99 - )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_CURENTST' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_FLATTYPE' ,@level2type = N'Column' ,@level2name = N'SHORTNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_FLATTYPE' ,@level2type = N'Column' ,@level2name = N'FLTYPEID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_FLATTYPE' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HSTSTAT' ,@level2type = N'Column' ,@level2name = N'HOUSESTID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HSTSTAT' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ()' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NDOCTYPE' ,@level2type = N'Column' ,@level2name = N'NDTYPEID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NDOCTYPE' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ()' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_OPERSTAT' ,@level2type = N'Column' ,@level2name = N'OPERSTATID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' 01 – ; 10 – ; 20 – ; 21 –  ; 30 – ; 31 -     ; 40 –    (); 41 –     ; 42 -        ; 43 -         ; 50 – ; 51 –     ; 60 –    ; 61 –       ; 70 –    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_OPERSTAT' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AOGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'FORMALNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'REGIONCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AUTOCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AREACODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CITYCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CTARCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PLACECODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'STREETCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'EXTRCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PLANCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'SEXTCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'OFFNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'SHORTNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AOLEVEL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PARENTGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  .  .' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'AOID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'      ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PREVID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'      ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'NEXTID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'          4.0. ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     4.0      (  )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'PLAINCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    .     .      . 0 –   1 -  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'ACTSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CENTSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    –    (.   OperationStatus): 01 – ; 10 – ; 20 – ; 21 –  ; 30 – ; 31 -     ; 40 –    (); 41 –     ; 42 -        ; 43 -         ; 50 – ; 51 –     ; 60 –    ; 61 –        ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'OPERSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   4 (    )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'CURRSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'LIVESTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'IFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'TERRIFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'IFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'TERRIFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKATO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'OKATO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKTMO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'OKTMO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_ADDROBJ' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'IFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'TERRIFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKATO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'OKATO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKTMO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'OKTMO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'INTSTART'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'INTEND'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'IFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'TERRIFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'HOUSEINTID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'INTGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    (, ,    ..)' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'AOGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  (, , )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'INTSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     4' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'COUNTER'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_NORMDOC' ,@level2type = N'Column' ,@level2name = N'NORMDOCID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ( )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCIMGID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKTMO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'OKTMO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKATO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'OKATO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'IFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'TERRIFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'TERRIFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'IFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  (, , )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'INTSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    (, ,    ..)' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'AOGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'INTGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'HOUSEINTID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'INTSTART'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'INTEND'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     4' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSEINT' ,@level2type = N'Column' ,@level2name = N'COUNTER'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  (, , )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_INTVSTAT' ,@level2type = N'Column' ,@level2name = N'INTVSTATID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_INTVSTAT' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'LANDGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    (, ,    ..)' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'AOGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'LANDID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'LOCATION'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'TERRIFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'IFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKTMO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'OKTMO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKATO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'OKATO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'IFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_LANDMARK' ,@level2type = N'Column' ,@level2name = N'TERRIFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NORMDOC' ,@level2type = N'Column' ,@level2name = N'NORMDOCID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ( )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_NORMDOC' ,@level2type = N'Column' ,@level2name = N'DOCIMGID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOMTYPE' ,@level2type = N'Column' ,@level2name = N'SHORTNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOMTYPE' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOMTYPE' ,@level2type = N'Column' ,@level2name = N'RMTYPEID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_SOCRBASE' ,@level2type = N'Column' ,@level2name = N'LEVEL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_SOCRBASE' ,@level2type = N'Column' ,@level2name = N'SCNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_SOCRBASE' ,@level2type = N'Column' ,@level2name = N'SOCRNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_SOCRBASE' ,@level2type = N'Column' ,@level2name = N'KOD_T_ST'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' 0 –   1 –  (    ) ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ACTSTAT' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ()' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ACTSTAT' ,@level2type = N'Column' ,@level2name = N'ACTSTATID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_CENTERST' ,@level2type = N'Column' ,@level2name = N'CENTERSTID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_CENTERST' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'IFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'TERRIFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'IFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'TERRIFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKATO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'OKATO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKTMO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'OKTMO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'HOUSENUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'ESTSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'BUILDNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'STRUCNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'STRSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'HOUSEID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'HOUSEGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'Guid    (, ,    ..)' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'AOGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'STATSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     4' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'COUNTER'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'CADNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' : 0 -   1 - ; 2 - -' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_HOUSE' ,@level2type = N'Column' ,@level2name = N'DIVTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ESTSTAT' ,@level2type = N'Column' ,@level2name = N'ESTSTATID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ESTSTAT' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ESTSTAT' ,@level2type = N'Column' ,@level2name = N'SHORTNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     ( )' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'STEADGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'NUMBER'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'REGIONCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'IFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'TERRIFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'IFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'TERRIFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKATO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'OKATO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKTMO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'OKTMO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'PARENTGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  .  .' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'STEADID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'      ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'PREVID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'      ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'NEXTID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    –    (.   OperationStatus): 01 – ; 10 – ; 20 – ; 21 –  ; 30 – ; 31 -     ; 40 –    (); 41 –     ; 42 -        ; 43 -         ; 50 – ; 51 –     ; 60 –    ; 61 –        ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'OPERSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'LIVESTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'CADNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' : 0 -   1 - ; 2 - -' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STEAD' ,@level2type = N'Column' ,@level2name = N'DIVTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'LOCATION'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'IFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'TERRIFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'IFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'TERRIFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKATO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'OKATO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKTMO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'OKTMO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'LANDID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'LANDGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    (, ,    ..)' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'AOGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_DEL_LANDMARK' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'REGIONCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'IFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'TERRIFNSFL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'IFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'TERRIFNSUL'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKATO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'OKATO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'OKTMO' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'OKTMO'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'HOUSENUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'ESTSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'BUILDNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'STRUCNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'STRSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'HOUSEID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'HOUSEGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'Guid    (, ,    ..)' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'AOGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'STATSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     4' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'COUNTER'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'CADNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' : 0 -   1 - ; 2 - -' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_HOUSE' ,@level2type = N'Column' ,@level2name = N'DIVTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'     ()' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'ROOMGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'FLATNUMBER'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'FLATTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'ROOMNUMBER'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'ROOMTYPE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'REGIONCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'POSTALCODE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'UPDATEDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ()' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'HOUSEGUID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  .  .' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'ROOMID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'      ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'PREVID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'      ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'NEXTID'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'STARTDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'ENDDATE'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'   ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'LIVESTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'NORMDOC'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    –    (.   OperationStatus): 01 – ; 10 – ; 20 – ; 21 –  ; 30 – ; 31 -     ; 40 –    (); 41 –     ; 42 -        ; 43 -         ; 50 – ; 51 –     ; 60 –    ; 61 –        ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'OPERSTATUS'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'  ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'CADNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'    ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_ROOM' ,@level2type = N'Column' ,@level2name = N'ROOMCADNUM'; EXEC sp_addextendedproperty @name = 'description' ,@value = N'' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STRSTAT' ,@level2type = N'Column' ,@level2name = N'NAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STRSTAT' ,@level2type = N'Column' ,@level2name = N'SHORTNAME'; EXEC sp_addextendedproperty @name = 'description' ,@value = N' ' ,@level0type = N'Schema' ,@level0name = N'dbo' ,@level1type = N'Table' ,@level1name = N'_STRSTAT' ,@level2type = N'Column' ,@level2name = N'STRSTATID' 


5. Modify the schemes themselves:

 --      update a Set x.modify ('declare namespace xs="http://www.w3.org/2001/XMLSchema"; insert <xs:import namespace="http://schemas.microsoft.com/sqlserver/2004/sqltypes" schemaLocation="./sqltypes.xsd" /> as first into (xs:schema)[1]') from dbo.[_FIAS_SCHEMAS] a --    update a Set x.modify('declare namespace ss="urn:schemas-microsoft-com:mapping-schema"; insert ( attribute ss:is-constant {"1"} ) into (/xs:schema[1]/xs:element[1])') from dbo.[_FIAS_SCHEMAS] a --  ,         update a Set x.modify('declare namespace ss="urn:schemas-microsoft-com:mapping-schema"; insert ( attribute ss:relation {sql:column("a.table")} ) into (xs:schema[1]/xs:element[1]/xs:complexType[1]/xs:sequence[1]/xs:element[1])') from dbo.[_FIAS_SCHEMAS] a --     -- ..  1       -    Declare @table nvarchar(4000) Declare @column nvarchar(4000) Declare cur CURSOR LOCAL FORWARD_ONLY for Select [table], [column] from dbo.[_FIAS] Open cur FETCH NEXT FROM cur into @table, @column WHILE @@FETCH_STATUS = 0 BEGIN update a Set x.modify('declare namespace ss="urn:schemas-microsoft-com:mapping-schema"; insert ( attribute ss:field {sql:column("t.column")} ,attribute ss:datatype {sql:column("b.sqltype")} ) into (//xs:attribute[@name = sql:column("b.column")])[1]') from dbo.[_FIAS_SCHEMAS] a inner join dbo.[_FIAS] b on a.[table] = b.[table] cross apply (Values(QUOTENAME(b.[column]))) t([column]) Where b.[table] = @table and b.[column] = @column FETCH NEXT FROM cur into @table, @column END CLOSE cur; DEALLOCATE cur; 

6. And finally, unload the xsd scheme to disk for further use:

 --   --  ,     - ! Set @sql = ( Select N'; exec xp_cmdshell ''bcp "Select [x] from [FIAS2].[dbo].[_FIAS_SCHEMAS] where [table] = ''''' + a.[table] + '''''" queryout "c:\files\FIAS\' + a.[table] + '.xsd" -S . -T -w''' from dbo.[_FIAS_SCHEMAS] a for xml path(N''), type ).value(N'.', N'nvarchar(max)') exec (@sql) 

Everything! :-)))

Here is the entire query that generates the tables, their descriptions, modifies the schemas and uploads them to disk:
 USE [FIAS2] go if OBJECT_ID('dbo.[_FIAS]') is not null drop table dbo.[_FIAS] go if OBJECT_ID('dbo._FIAS_SCHEMAS') is not null drop table dbo.[_FIAS_SCHEMAS] go Declare @schema sysname = N'dbo' Declare @sql nvarchar(max) Create table dbo.[_FIAS_SCHEMAS] (x xml, [table] sysname) insert into dbo.[_FIAS_SCHEMAS] (x, [table]) SELECT x = CAST(BulkColumn AS XML).query('.'), '_ACTSTAT' [table] FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ACTSTAT_2_250_08_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_ADDROBJ' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ADDROBJ_2_250_01_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_CENTERST' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_CENTERST_2_250_10_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_CURENTST' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_CURENTST_2_250_07_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_ADDROBJ' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_ADDROBJ_2_250_15_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_HOUSEINT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_HOUSEINT_2_250_17_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_HOUSE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_HOUSE_2_250_16_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_LANDMARK' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_LANDMARK_2_250_18_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_DEL_NORMDOC' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_DEL_NORMDOC_2_250_19_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_ESTSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ESTSTAT_2_250_13_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_FLATTYPE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_FLATTYPE_2_250_23_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_HOUSEINT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_HOUSEINT_2_250_03_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_HOUSE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_HOUSE_2_250_02_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_HSTSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_HSTSTAT_2_250_12_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_INTVSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_INTVSTAT_2_250_11_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_LANDMARK' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_LANDMARK_2_250_04_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_NDOCTYPE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_NDOCTYPE_2_250_20_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_NORMDOC' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_NORMDOC_2_250_05_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_OPERSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_OPERSTAT_2_250_09_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_ROOMTYPE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ROOMTYPE_2_250_24_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_ROOM' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_ROOM_2_250_21_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_SOCRBASE' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_SOCRBASE_2_250_06_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_STEAD' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_STEAD_2_250_22_04_01_01.xsd', SINGLE_BLOB) x Union all SELECT x = CAST(BulkColumn AS XML).query('.'), '_STRSTAT' FROM OPENROWSET(BULK '\\s01sq03\c$\files\FIAS\AS_STRSTAT_2_250_14_04_01_01.xsd', SINGLE_BLOB) x ;WITH XMLNAMESPACES ('http://www.w3.org/2001/XMLSchema' as xs) Select a.[table] ,tbl.[root_name] ,tbl.[root_description] ,tbl.[name] ,ROW_NUMBER() over (partition by a.[table] order by 1/0) N ,tbl.[column] ,tbl.[required] ,tbl.[description] ,tbl.[type] ,tbl.[len] ,Case tbl.[type] when N'byte' then N'tinyint' when N'date' then N'date' when N'int' then N'int' when N'string' then Case when tbl.[len] = 36 and (tbl.[column] like N'%ID' or tbl.[column] = N'NORMDOC') then N'uniqueidentifier' when tbl.[len] is Null then N'nvarchar(max)' Else N'nvarchar(' + cast(tbl.[len] as nvarchar(4000)) + N')' END when N'integer' then Case when tbl.[len] > 9 then N'bigint' when tbl.[len] <= 4 then N'smallint' Else N'int' end else N'nvarchar(max)' End [sqltype] ,tnquery('.') [node] into dbo.[_FIAS] from dbo.[_FIAS_SCHEMAS] a Cross apply axnodes('//xs:attribute') t(n) Cross apply (values --     ,    :) ( x.value('(xs:schema[1]/xs:element[1]/@name)', 'nvarchar(255)') ,x.value('(xs:schema[1]/xs:element[1]/xs:annotation/xs:documentation[1]/text())[1]', 'nvarchar(4000)') ,x.value('(xs:schema[1]/xs:element[1]/xs:complexType[1]/xs:sequence[1]/xs:element[1]/@name)', 'nvarchar(255)') ,tnvalue('(./@name)[1]', 'nvarchar(255)') ,tnvalue('(./@use)[1]', 'nvarchar(255)') ,Stuff(Coalesce(tnvalue('(./xs:simpleType/xs:restriction/@base)[1]', 'nvarchar(255)'), tnvalue('(./@type)[1]', 'nvarchar(255)')), 1, 3, '') ,Coalesce(tnvalue('(./xs:simpleType/xs:restriction/xs:length/@value)[1]', 'int') ,tnvalue('(./xs:simpleType/xs:restriction/xs:maxLength/@value)[1]', 'int') ,tnvalue('(./xs:simpleType/xs:restriction/xs:totalDigits/@value)[1]', 'int')) ,Replace( Replace( Replace( Replace( Replace( Replace( Replace( Replace( Replace(tnvalue('(./xs:annotation/xs:documentation)[1]', 'nvarchar(4000)'), ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') ) ) tbl([root_name], [root_description], [name], [column], [required], [type], [len], [description]) --    Select * from dbo.[_FIAS] --     ,    set @sql = ( Select Distinct N';Create table ' + Quotename(@schema) + N'.' + Quotename([table]) + N'(' + Stuff((Select N',' + QUOTENAME(b.[column]) + N' ' + b.[sqltype] + Case b.[required] when 'required' then N' NOT NULL' when 'optional' then N' NULL' End From dbo.[_FIAS] b where b.[table] = a.[table] Order by N ASC For xml path(N''), type ).value(N'.', 'nvarchar(max)'), 1, 1, N'') + N')' from dbo.[_FIAS] a For xml path(N''), type).value(N'.', N'nvarchar(max)') exec (@sql) --       Set @sql = ( Select N'; exec sp_addextendedproperty @name=''description'', @value=N''' + a.[root_description] + N''', @level0type =N''Schema'', @level0name = N''' + @schema + N''', @level1type = N''Table'', @level1name = N''' + a.[table] + N'''' from (Select distinct [table], [root_description] from dbo.[_FIAS]) a for xml path(N''), type ).value(N'.', N'nvarchar(max)') exec (@sql) Set @sql = ( Select N'; exec sp_addextendedproperty @name=''description'', @value=N''' + a.[description] + N''', @level0type =N''Schema'', @level0name = N''' + @schema + N''', @level1type = N''Table'', @level1name = N''' + a.[table] + N''', @level2type = N''Column'', @level2name = N''' + a.[column] + N'''' from dbo.[_FIAS] a for xml path(N''), type ).value(N'.', N'nvarchar(max)') exec (@sql) --      update a Set x.modify ('declare namespace xs="http://www.w3.org/2001/XMLSchema"; insert <xs:import namespace="http://schemas.microsoft.com/sqlserver/2004/sqltypes" schemaLocation="./sqltypes.xsd" /> as first into (xs:schema)[1]') from dbo.[_FIAS_SCHEMAS] a --    update a Set x.modify('declare namespace ss="urn:schemas-microsoft-com:mapping-schema"; insert ( attribute ss:is-constant {"1"} ) into (/xs:schema[1]/xs:element[1])') from dbo.[_FIAS_SCHEMAS] a --  ,         update a Set x.modify('declare namespace ss="urn:schemas-microsoft-com:mapping-schema"; insert ( attribute ss:relation {sql:column("a.table")} ) into (xs:schema[1]/xs:element[1]/xs:complexType[1]/xs:sequence[1]/xs:element[1])') from dbo.[_FIAS_SCHEMAS] a --     -- ..  1       -    Declare @table nvarchar(4000) Declare @column nvarchar(4000) Declare cur CURSOR LOCAL FORWARD_ONLY for Select [table], [column] from dbo.[_FIAS] Open cur FETCH NEXT FROM cur into @table, @column WHILE @@FETCH_STATUS = 0 BEGIN update a Set x.modify('declare namespace ss="urn:schemas-microsoft-com:mapping-schema"; insert ( attribute ss:field {sql:column("t.column")} ,attribute ss:datatype {sql:column("b.sqltype")} ) into (//xs:attribute[@name = sql:column("b.column")])[1]') from dbo.[_FIAS_SCHEMAS] a inner join dbo.[_FIAS] b on a.[table] = b.[table] cross apply (Values(QUOTENAME(b.[column]))) t([column]) Where b.[table] = @table and b.[column] = @column FETCH NEXT FROM cur into @table, @column END CLOSE cur; DEALLOCATE cur; --   --  ,     - ! Set @sql = ( Select N'; exec xp_cmdshell ''bcp "Select [x] from [FIAS2].[dbo].[_FIAS_SCHEMAS] where [table] = ''''' + a.[table] + '''''" queryout "c:\files\FIAS\' + a.[table] + '.xsd" -S . -T -w''' from dbo.[_FIAS_SCHEMAS] a for xml path(N''), type ).value(N'.', N'nvarchar(max)') exec (@sql) 


Now it remains only to call the download procedure for each xml file with the corresponding scheme (the unpacked files themselves are stored in the e: \ tmp folder, and we downloaded the schemes to c: \ files \ FIAS):

 USE FIAS2 GO Declare @sql nvarchar(max) if OBJECT_ID('tempdb..#t') is not null drop table #t Create table #t ([output] sysname NULL) insert into #t exec xp_cmdshell 'dir e:\tmp /B' ;With load_data as ( Select '_' + txvalue('(a[2])', 'nvarchar(255)') [table] ,txvalue('(a[3])', 'date') [fias_date] ,txvalue('(a[4])', 'uniqueidentifier') [fias_guid] ,a.[output] [file_name] from #ta cross apply (VALUES(Cast('<a>' + Replace(Replace(Replace(Replace(a.[output],'DEL_', 'DEL$'), '_', '</a><a>'), '.', '</a><a>'), '$', '_') + '</a>' as xml))) t(x) Where [output] like 'AS[_]%.xml' ) Select @sql = (Select N';exec [dbo].[spXMLBulkLoad] ''e:\tmp\' + a.[file_name] + ''', ''c:\files\FIAS\' + b.[table] + '.xsd'', ''FIAS2'', ''e:\tmp\err.xml''' from load_data a inner join [dbo].[_FIAS_SCHEMAS] b on a.[table] = b.[table] For xml path(''), type).value(N'.', N'nvarchar(max)') Exec (@sql) 

Fffu ...

Well, now finally all.

However, that's what I want to tell you, dear colleagues!
It all works just awfully slow!
I'm not talking about creating tables and charts, of course. And about the download.

In the test environment, my download lasted for almost 5 hours (sic !!!). And this is still without indexing the tables.

The load on the I / O system was at the level of 3 Mb / s, and only a couple of cores were involved.

The loading of address objects went at a speed of no more than 3 thousand records per second, the loading of houses — at a speed of no more than 8 thousand per second. And their, for a minute, 60 million.
What is the reason for this - I can not say, I will have to dig deeper with the code and, apparently, with the VM setup.

Please note that the download is heaped. And then it is supposed to create clustered indexes for all sorts of their AOID.

Becausethey are GUIDs, it is better to do this, because if you create clustered indexes BEFORE loading, the output will be a table fragmented somewhere by 50 percent, no less. Well, it is also better to create indexes after loading, because inserting into indexes makes loading even slower.

That is why my table names begin with an underscore (_). It was assumed that I first load the data into them, then I will recreate the indexes of the target tables, and then, calmly, I will do the Alter table switch.

Also pay attention to the not quite optimal data types for the fields of FIAS tables.
For example, using int, where tinyint is enough, or nvarchar in fields where only numeric values ​​are supposed to be stored, such as a region code or OKATO.
So in the schemes :-(.

However, nothing prevents you, after creating the metadata table, [dbo]. [_ FIAS], dig deeper into it with your hands and perform tuning, and only then create new boot charts based on the corrected metadata.

Well, and if you still can’t get rid of such slow loading, you will probably have to go back to the dbf boot option, and finally crack the crack in small dbf. And write another article.

dbf in 8 threads normally loaded in 1 hour with kopecks, and about an hour more went on merging separate tables into target tables, and building indexes on them.

... Well, or, finally, pull your hands out of LJ ... uh ... ahedrona, and finally make a normal data tier application, and load the data already, like all normal people, through SSIS.

But that's another story.

→Scripts and xsd diagrams

Related Links:

→ FIAS A

picture with a dog is not mine :-)

Source: https://habr.com/ru/post/451720/


All Articles