{"id":354060,"date":"2024-05-20T22:40:48","date_gmt":"2024-05-20T22:40:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=354060"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=354060","title":{"rendered":"<span>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0421\u0423\u0411\u0414 \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f 1\u0421?<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u2013 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u0445 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0421\u0423\u0411\u0414. \u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0438\u0434\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430, \u0440\u0435\u0436\u0438\u043c\u0430 \u0437\u0430\u043f\u0438\u0441\u0438, \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432? <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0421\u0423\u0411\u0414 \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0438 \u043e\u0431\u043e\u0440\u043e\u0442\u043e\u0432 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432 \u0438 \u0431\u0435\u0437. <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 1\u0421 8.3.23 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 MSSQL.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u0441\u0435\u0445 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fd8\/4a0\/a7f\/fd84a0a7f8cba3970df607260a5ec3d6.png\" width=\"498\" height=\"476\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fd8\/4a0\/a7f\/fd84a0a7f8cba3970df607260a5ec3d6.png\"\/><\/figure>\n<p>\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u2013 \u0441\u0441\u044b\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0440\u0435\u0441\u0443\u0440\u0441 \u2013 \u0447\u0438\u0441\u043b\u043e, \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442 \u2013 \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<h2>\u0420\u0435\u0433\u0438\u0441\u0442\u0440 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432<\/h2>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432, \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0439 \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0430\u0431\u043b\u0438\u0446 SQL \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c39\/099\/a68\/c39099a68b6f6c7643d8cd6c822bd72d.png\" width=\"1420\" height=\"303\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c39\/099\/a68\/c39099a68b6f6c7643d8cd6c822bd72d.png\"\/><\/figure>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439 = \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u044b\u041d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f.\u041e\u0441\u0442\u0430\u0442\u043a\u0438\u0411\u0435\u0437\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u0418\u0442\u043e\u0433\u043e\u0432.\u0421\u043e\u0437\u0434\u0430\u0442\u044c\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439(); \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0442\u0431\u043e\u0440.\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440.\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c(\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440);   \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 = \u0420\u0435\u0436\u0438\u043c\u0417\u0430\u043f\u0438\u0441\u0438;  \u0417\u0430\u043f\u0438\u0441\u044c = \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c(); \u0417\u0430\u043f\u0438\u0441\u044c.\u041f\u0435\u0440\u0438\u043e\u0434 = \u041f\u0435\u0440\u0438\u043e\u0434; \u0417\u0430\u043f\u0438\u0441\u044c.\u0412\u0438\u0434\u0414\u0432\u0438\u0436\u0435\u043d\u0438\u044f = \u0412\u0438\u0434\u0414\u0432\u0438\u0436\u0435\u043d\u0438\u044f; \u0417\u0430\u043f\u0438\u0441\u044c.\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04351 = \u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04351; \u0417\u0430\u043f\u0438\u0441\u044c.\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04352 = \u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04352; \u0417\u0430\u043f\u0438\u0441\u044c.\u0420\u0435\u0441\u0443\u0440\u04411 = 1; \u0417\u0430\u043f\u0438\u0441\u044c.\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u04421 = \"\u0442\u0435\u0441\u0442\";  \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u0417\u0430\u043c\u0435\u0449\u0430\u0442\u044c);<\/code><\/pre>\n<h3>\u041e\u0441\u0442\u0430\u0442\u043a\u0438, \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0438\u0442\u043e\u0433\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b<\/h3>\n<p>\u0420\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 = \u041b\u043e\u0436\u044c; \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u041b\u043e\u0436\u044c);<\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<p>1.1 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION<\/code><\/pre>\n<p>1.2 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0421\u0423\u0411\u0414, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u0442\u043e\u0433\u043e\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._UseTotals, T1._ActualPeriod, T1._UseSplitter, T1._MinPeriod, T1._MinCalculatedPeriod FROM dbo._AccumRgOpt93 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<p>1.3 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443.<\/p>\n<pre><code class=\"sql\">SELECT TOP 1 T1._LineNo, T1._Active FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo DESC<\/code><\/pre>\n<p>1.4 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRg72 (_Period,_RecorderRRef,_LineNo,_Active,_RecordKind,_Fld73RRef,_Fld74RRef,_Fld75,_Fld76)  VALUES(@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9)<\/code><\/pre>\n<p>1.5 \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0442\u043e\u0433\u043e\u0432. \u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u0442\u043e\u0433\u0430\u0445 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0445 \u0438\u0442\u043e\u0433\u043e\u0432(\u043a\u043e\u043d\u0435\u0446 \u043c\u0435\u0441\u044f\u0446\u0430) \u0438 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<pre><code class=\"sql\">UPDATE T1 SET _Fld75 = T1._Fld75 + @P1 FROM dbo._AccumRgT77 T1 WHERE T1._Period = @P2 AND T1._Fld73RRef = @P3 AND T1._Fld74RRef = @P4<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0432 \u0431\u043b\u043e\u043a \u043e\u0442\u0431\u043e\u0440\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e &#171;AND T1._Splitter = @P5&#187;.  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0435\u043c\u0443 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432.<\/p>\n<pre><code class=\"sql\">UPDATE T1 SET _Fld55 = T1._Fld55 + @P1 FROM dbo._AccumRgT57 T1 WHERE T1._Period = @P2 AND T1._Fld53RRef = @P3 AND T1._Fld54RRef = @P4 AND T1._Splitter = @P5<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0441 \u0432\u0438\u0434\u043e\u043c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0434 \u0440\u0435\u0441\u0443\u0440\u0441 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u043c \u0437\u043d\u0430\u043a\u043e\u043c(T1._Fld75 + -@P1).<\/p>\n<p>1.6 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0442\u043e\u0433\u043e\u0432. \u0414\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0435\u0441\u043b\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043d\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043f\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u043c \u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0443 \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgT77 (_Period,_Fld73RRef,_Fld74RRef,_Fld75)  VALUES(@P1,@P2,@P3,@P4)<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435 &#171;_Splitter&#187;.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgT57 (_Period,_Fld53RRef,_Fld54RRef,_Fld55,_Splitter)  VALUES(@P1,@P2,@P3,@P4,@P5)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>1.7 \u0424\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">COMMIT TRANSACTION<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0431\u0435\u0437 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0431\u0435\u0437 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439 \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443, \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441 1.3. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._RecorderRRef, T1._LineNo, T1._Active, T1._RecordKind, T1._Fld73RRef, T1._Fld74RRef, T1._Fld75, T1._Fld76 FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u041e\u0441\u0442\u0430\u0442\u043a\u0438, \u0441 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c, \u0438\u0442\u043e\u0433\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b<\/h3>\n<p>\u0420\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 - \"\u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b\"; \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u0418\u0441\u0442\u0438\u043d\u0430);<\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<p>2.1 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION<\/code><\/pre>\n<p>2.2 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0421\u0423\u0411\u0414, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u0442\u043e\u0433\u043e\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043f\u0440\u043e\u0441 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u0430\u043a 1.2<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">SELECT T1._Period, T1._UseTotals, T1._ActualPeriod, T1._UseSplitter, T1._MinPeriod, T1._MinCalculatedPeriod FROM dbo._AccumRgOpt93 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>2.3 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._RecorderRRef, T1._LineNo, T1._Active, T1._RecordKind, T1._Fld73RRef, T1._Fld74RRef, T1._Fld75, T1._Fld76 FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo<\/code><\/pre>\n<p>2.4 \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435. \u0415\u0441\u043b\u0438 \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435, \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<pre><code class=\"sql\">DELETE FROM T1 FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 AND ((T1._LineNo >= @P2 AND T1._LineNo &lt; @P3))<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043e\u0442\u0431\u043e\u0440\u0430:<\/p>\n<pre><code class=\"sql\">WHERE T1._RecorderRRef = @P1 AND ((T1._LineNo = @P2))<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043d\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443<\/p>\n<pre><code class=\"sql\">WHERE T1._RecorderRRef = @P1 AND ((T1._LineNo >= @P2 AND T1._LineNo &lt; @P3) OR (T1._LineNo >= @P4 AND T1._LineNo &lt; @P5)) <\/code><\/pre>\n<p>2.5 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u0438 \u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRg72 (_Period,_RecorderRRef,_LineNo,_Active,_RecordKind,_Fld73RRef,_Fld74RRef,_Fld75,_Fld76)  VALUES(@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9)<\/code><\/pre>\n<p>2.6 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt1') IS NOT NULL<\/code><\/pre>\n<p>2.7 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt1 (_Period DATETIME2(0), _RecordKind NUMERIC(1, 0), _Fld73RRef BINARY(16), _Fld74RRef BINARY(16), _Fld75 NUMERIC(16, 0))<\/code><\/pre>\n<p>2.8 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt1 (_Period,_RecordKind,_Fld73RRef,_Fld74RRef,_Fld75)  VALUES(@P1,@P2,@P3,@P4,@P5)<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u0430 \u043f\u043e\u043b\u0435\u0439 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f+\u043f\u0435\u0440\u0438\u043e\u0434 \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0440\u0435\u0441\u0443\u0440\u0441 \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u041f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0437\u043d\u0430\u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0438\u0434\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0438 \u044d\u0442\u043e \u043d\u043e\u0432\u0430\u044f \u0438\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c. \u0412 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0434\u043b\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0441 \u0432\u0438\u0434\u043e\u043c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0445\u043e\u0434 \u0437\u043d\u0430\u043a \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0440\u0435\u0441\u0443\u0440\u0441 \u0440\u0430\u0441\u0445\u043e\u0434\u0430 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u043c \u0437\u043d\u0430\u043a\u043e\u043c. \u0412 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442: \u043f\u0440\u0438\u0445\u043e\u0434 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u043c \u0437\u043d\u0430\u043a\u043e\u043c, \u0440\u0430\u0441\u0445\u043e\u0434 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. <\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"center\">\u0412\u0438\u0434 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f\/\u0417\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u041d\u043e\u0432\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"center\">\u041f\u0440\u0438\u0445\u043e\u0434<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0411\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0417\u043d\u0430\u043a \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"center\">\u0420\u0430\u0441\u0445\u043e\u0434<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0417\u043d\u0430\u043a \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0411\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0442\u043e\u0433\u0430\u043c\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u044c\u0442\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>2.9 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0438\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT MIN(T1._Period) FROM #tt1 T1 WITH(NOLOCK)<\/code><\/pre>\n<p>2.10 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt2') IS NOT NULL<\/code><\/pre>\n<p>2.11 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt2 (_Period DATETIME2(0))<\/code><\/pre>\n<p>2.12 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441.<\/p>\n<pre><code class=\"sql\">CREATE UNIQUE CLUSTERED INDEX idx4 ON #tt2 (_Period)<\/code><\/pre>\n<p>2.13 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0435\u0440\u0438\u043e\u0434\u044b, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0442\u043e\u0433\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt2 (_Period) VALUES(@P1)<\/code><\/pre>\n<p>2.14 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt3') IS NOT NULL<\/code><\/pre>\n<p>2.15 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt3 (_Period DATETIME2(0), _Fld73RRef BINARY(16), _Fld74RRef BINARY(16), _Fld75 NUMERIC(22, 0))<\/code><\/pre>\n<p>2.16 \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt3 WITH(TABLOCK) (_Period, _Fld73RRef, _Fld74RRef, _Fld75) SELECT T2._Period, T1._Fld73RRef, T1._Fld74RRef, CAST(SUM(CASE WHEN T1._RecordKind = 0.0 THEN T1._Fld75 ELSE -T1._Fld75 END) AS NUMERIC(22, 0)) FROM #tt1 T1 WITH(NOLOCK) INNER JOIN #tt2 T2 WITH(NOLOCK) ON T1._Period &lt; T2._Period GROUP BY T2._Period, T1._Fld73RRef, T1._Fld74RRef<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0433\u0434\u0430 \u0434\u0430\u0442\u0430 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u0442\u044b \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0415\u0441\u043b\u0438 \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u0441 \u0434\u0430\u0442\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u0442\u044b \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0442\u043e\u0433\u043e\u0432, \u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b 2.10-2.13 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442. \u0417\u0430\u043f\u0440\u043e\u0441 2.16 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt3 WITH(TABLOCK) (_Period, _Fld53RRef, _Fld54RRef, _Fld55) SELECT @P1, T1._Fld53RRef, T1._Fld54RRef, CAST(SUM(CASE WHEN T1._RecordKind = 0.0 THEN T1._Fld55 ELSE -T1._Fld55 END) AS NUMERIC(22, 0)) FROM #tt1 T1 WITH(NOLOCK) GROUP BY T1._Fld53RRef, T1._Fld54RRef <\/code><\/pre>\n<p>\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<\/div>\n<\/details>\n<p>2.17 \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0421\u0423\u0411\u0414.<\/p>\n<pre><code class=\"sql\">UPDATE T2 SET _Fld75 = T2._Fld75 + T1._Fld75 FROM #tt3 T1 WITH(NOLOCK) INNER JOIN dbo._AccumRgT77 T2 ON T1._Period = T2._Period AND T1._Fld73RRef = T2._Fld73RRef AND T1._Fld74RRef = T2._Fld74RRef<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#171;AND T2._Splitter = @P1&#187;.<\/p>\n<pre><code class=\"sql\">UPDATE T2 SET _Fld55 = T2._Fld55 + T1._Fld55 FROM #tt3 T1 WITH(NOLOCK) INNER JOIN dbo._AccumRgT57 T2 ON T1._Period = T2._Period AND T1._Fld53RRef = T2._Fld53RRef AND T1._Fld54RRef = T2._Fld54RRef AND T2._Splitter = @P1 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>2.18 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0435 \u0438\u0442\u043e\u0433\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgT77 (_Period, _Fld73RRef, _Fld74RRef, _Fld75) SELECT T1._Period, T1._Fld73RRef, T1._Fld74RRef, CAST(T1._Fld75 AS NUMERIC(16, 0)) FROM #tt3 T1 WITH(NOLOCK) LEFT OUTER JOIN dbo._AccumRgT77 T2 ON T2._Period = T1._Period AND T1._Fld73RRef = T2._Fld73RRef AND T1._Fld74RRef = T2._Fld74RRef WHERE T2._Period IS NULL<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#171;AND T2._Splitter = @P1&#187;.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgT57 (_Period, _Fld53RRef, _Fld54RRef, _Fld55, _Splitter) SELECT T1._Period, T1._Fld53RRef, T1._Fld54RRef, CAST(T1._Fld55 AS NUMERIC(16, 0)), CAST(@P1 AS NUMERIC(10, 0)) FROM #tt2 T1 WITH(NOLOCK) LEFT OUTER JOIN dbo._AccumRgT57 T2 ON T2._Period = T1._Period AND T1._Fld53RRef = T2._Fld53RRef AND T1._Fld54RRef = T2._Fld54RRef AND T2._Splitter = @P2 WHERE T2._Period IS NULL <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>2.19 \u0427\u0438\u0441\u0442\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt3<\/code><\/pre>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt2<\/code><\/pre>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt1<\/code><\/pre>\n<p>2.20 \u0424\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">COMMIT TRANSACTION<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f, \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u041f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u0430, \u0438\u043b\u0438 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438(\u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u0435\u0441\u0442\u0430\u043c\u0438), \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (2.1-2.5) \u0438 \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (2.20). \u0415\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u043f\u0435\u0440\u0438\u043e\u0434, \u043d\u0430 \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0442\u043e\u0433\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0431\u043e\u0440 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 2.1-2.3 \u0438 \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (2.20).<\/p>\n<h3>\u041e\u0441\u0442\u0430\u0442\u043a\u0438, \u0438\u0442\u043e\u0433\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u044b<\/h3>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u043a\u0430\u043a \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u043c\u0438 \u0438\u0442\u043e\u0433\u0430\u043c\u0438.<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438<\/summary>\n<div class=\"spoiler__content\">\n<p>3.1 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION<\/code><\/pre>\n<p>3.2 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0421\u0423\u0411\u0414, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u0442\u043e\u0433\u043e\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._UseTotals, T1._ActualPeriod, T1._UseSplitter, T1._MinPeriod, T1._MinCalculatedPeriod FROM dbo._AccumRgOpt93 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<p>3.3 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443<\/p>\n<p>3.3.1 \u0421 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._RecorderRRef, T1._LineNo, T1._Active, T1._RecordKind, T1._Fld73RRef, T1._Fld74RRef, T1._Fld75, T1._Fld76 FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo<\/code><\/pre>\n<p>3.3.2 \u0411\u0435\u0437 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"sql\">SELECT TOP 1 T1._LineNo, T1._Active FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo DESC <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>3.4 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443.<\/p>\n<pre><code class=\"sql\">SELECT MIN(T1._Period) FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1<\/code><\/pre>\n<p>3.5 \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0438\u043e\u0434 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/p>\n<pre><code class=\"sql\">UPDATE T1 SET _MinPeriod = @P1 FROM dbo._AccumRgOpt93 T1 WHERE T1._RegID = @P2 AND T1._MinPeriod > @P3<\/code><\/pre>\n<p>3.6 \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<pre><code class=\"sql\">DELETE FROM T1 FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 AND ((T1._LineNo >= @P2 AND T1._LineNo &lt; @P3))<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b 3.4-3.6 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f.<\/p>\n<p>3.7 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRg72 (_Period,_RecorderRRef,_LineNo,_Active,_RecordKind, _Fld73RRef,_Fld74RRef,_Fld75,_Fld76)  VALUES(@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9)<\/code><\/pre>\n<p>3.6 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443.<\/p>\n<pre><code class=\"sql\">SELECT MIN(T1._Period) FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1<\/code><\/pre>\n<p>3.7 \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0438\u043e\u0434 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/p>\n<pre><code class=\"sql\">UPDATE T1 SET _MinPeriod = @P1 FROM dbo._AccumRgOpt93 T1 WHERE T1._RegID = @P2 AND T1._MinPeriod > @P3<\/code><\/pre>\n<p>3.8 \u0424\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">COMMIT TRANSACTION<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0437\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0442\u043e\u0433\u0430\u043c\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0438\u0442\u043e\u0433\u043e\u0432, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u043e\u043b\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0415\u0441\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0431\u043e\u0440 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 3.1-3.3 \u0438 \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (3.8).<\/p>\n<p>\u041f\u0440\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0445 \u0438\u0442\u043e\u0433\u0430\u0445 \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438 \u0431\u0435\u0437 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<h2>\u0420\u0435\u0433\u0438\u0441\u0442\u0440 \u043e\u0431\u043e\u0440\u043e\u0442\u043e\u0432<\/h2>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432, \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0439 \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0430\u0431\u043b\u0438\u0446 SQL \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/910\/99a\/1a1\/91099a1a17d895a68e2d1bee2e2163bd.png\" width=\"1416\" height=\"764\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/910\/99a\/1a1\/91099a1a17d895a68e2d1bee2e2163bd.png\"\/><\/figure>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439 = \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u044b\u041d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f.\u041e\u0431\u043e\u0440\u043e\u0442\u044b\u0411\u0435\u0437\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u0418\u0442\u043e\u0433\u043e\u0432.\u0421\u043e\u0437\u0434\u0430\u0442\u044c\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439(); \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0442\u0431\u043e\u0440.\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440.\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c(\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440);   \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 = \u0420\u0435\u0436\u0438\u043c\u0417\u0430\u043f\u0438\u0441\u0438; \u0417\u0430\u043f\u0438\u0441\u044c = \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c(); \u0417\u0430\u043f\u0438\u0441\u044c.\u041f\u0435\u0440\u0438\u043e\u0434 = \u041f\u0435\u0440\u0438\u043e\u0434; \u0417\u0430\u043f\u0438\u0441\u044c.\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04351 = \u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04351; \u0417\u0430\u043f\u0438\u0441\u044c.\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04352 = \u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04352; \u0417\u0430\u043f\u0438\u0441\u044c.\u0420\u0435\u0441\u0443\u0440\u04411 = 1; \u0417\u0430\u043f\u0438\u0441\u044c.\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u04421 = \"\u0442\u0435\u0441\u0442\"; \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u0417\u0430\u043c\u0435\u0449\u0430\u0442\u044c);<\/code><\/pre>\n<h3>\u041e\u0431\u043e\u0440\u043e\u0442\u044b, \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0438\u0442\u043e\u0433\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b<\/h3>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0431\u043e\u0440\u043e\u0442\u043e\u0432 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0442\u043e\u0433\u0430\u043c\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u043e\u0434\u043d\u0438\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c: \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 (4.4).<\/p>\n<p>\u0420\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 = \u041b\u043e\u0436\u044c; \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u041b\u043e\u0436\u044c);<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p>4.1 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION<\/code><\/pre>\n<p>4.2 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0421\u0423\u0411\u0414, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u0442\u043e\u0433\u043e\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._UseTotals, T1._ActualPeriod, T1._UseSplitter, T1._MinPeriod, T1._MinCalculatedPeriod FROM dbo._AccumRgOpt94 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<p>4.3 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443<\/p>\n<pre><code class=\"sql\">SELECT TOP 1 T1._LineNo, T1._Active FROM dbo._AccumRg78 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo DESC <\/code><\/pre>\n<p>4.4 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432<\/p>\n<pre><code class=\"sql\">SELECT T1._AggMode, T1._EnableUse, T1._FillStartDate, T1._FillEndDate, T1._DeltaPeriodic, T1._BufferPeriodic, T1._State FROM dbo._AccumRgAggOptK85 T1 WHERE T1._RegID = @P1 <\/code><\/pre>\n<p>4.5 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRg78 (_Period,_RecorderRRef,_LineNo,_Active,_Fld79RRef,_Fld80RRef, _Fld81,_Fld82) VALUES(@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8) <\/code><\/pre>\n<p>4.6 \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0442\u043e\u0433\u043e\u0432, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430\u0431\u043e\u0440\u0430<\/p>\n<pre><code class=\"sql\">UPDATE T1 SET _Fld81 = T1._Fld81 + @P1 FROM dbo._AccumRgTn83 T1 WHERE T1._Period = @P2 AND T1._Fld79RRef = @P3 AND T1._Fld80RRef = @P4<\/code><\/pre>\n<p>4.7 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0442\u043e\u0433\u043e\u0432. \u0414\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0435\u0441\u043b\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043d\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043f\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u043c \u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0443 \u0438\u0442\u043e\u0433\u043e\u0432<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgTn83 (_Period,_Fld79RRef,_Fld80RRef,_Fld81)  VALUES(@P1,@P2,@P3,@P4)<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 4.6 \u0438 4.7 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c, \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c 1.5 \u0438 1.6 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>4.8 \u0424\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"sql\">COMMIT TRANSACTION<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u041e\u0431\u043e\u0440\u043e\u0442\u044b, \u0441 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c, \u0438\u0442\u043e\u0433\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b<\/h3>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u0431\u043e\u0440\u043e\u0442\u043e\u0432 \u0441 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u0434\u043e\u0431\u043d\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432(\u0443\u0431\u0440\u0430\u043d\u044b \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440), \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<p>\u0420\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 - \"\u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b\"; \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u0418\u0441\u0442\u0438\u043d\u0430);<\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p>5.1 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION<\/code><\/pre>\n<p>5.2 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0421\u0423\u0411\u0414.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._UseTotals, T1._ActualPeriod, T1._UseSplitter, T1._MinPeriod, T1._MinCalculatedPeriod FROM dbo._AccumRgOpt94 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<p>5.3 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._RecorderRRef, T1._LineNo, T1._Active, T1._Fld79RRef, T1._Fld80RRef, T1._Fld81, T1._Fld82 FROM dbo._AccumRg78 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo<\/code><\/pre>\n<p>5.4 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432.<\/p>\n<pre><code class=\"sql\">SELECT T1._AggMode, T1._EnableUse, T1._FillStartDate, T1._FillEndDate, T1._DeltaPeriodic, T1._BufferPeriodic, T1._State FROM dbo._AccumRgAggOptK85 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<p>5.5 \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435.<\/p>\n<pre><code class=\"sql\">DELETE FROM T1 FROM dbo._AccumRg78 T1 WHERE T1._RecorderRRef = @P1 AND ((T1._LineNo >= @P2 AND T1._LineNo &lt; @P3))<\/code><\/pre>\n<p>5.6 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRg78 (_Period,_RecorderRRef,_LineNo,_Active,_Fld79RRef,_Fld80RRef,_Fld81,_Fld82)  VALUES(@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt1') IS NOT NULL<\/code><\/pre>\n<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt1 (_Period DATETIME2(0), _Fld79RRef BINARY(16), _Fld80RRef BINARY(16), _Fld81 NUMERIC(16, 0))<\/code><\/pre>\n<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt1 (_Period,_Fld79RRef,_Fld80RRef,_Fld81)  VALUES(@P1,@P2,@P3,@P4)<\/code><\/pre>\n<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt2') IS NOT NULL<\/code><\/pre>\n<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt2 (_Period DATETIME2(0), _Fld79RRef BINARY(16), _Fld80RRef BINARY(16), _Fld81 NUMERIC(22, 0))<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0438\u0442\u043e\u0433\u043e\u0432 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u044d\u0442\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0438\u0442\u043e\u0433\u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u0432, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0437\u0430 \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438. \u0412 \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u044d\u0442\u043e\u0433\u043e, \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u043f\u0435\u0440\u0438\u043e\u0434\u0430\u043c\u0438 \u0438 \u0438\u0442\u043e\u0433\u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<p>5.12 \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt2 WITH(TABLOCK) (_Period, _Fld79RRef, _Fld80RRef, _Fld81) SELECT DATETIME2FROMPARTS(DATEPART(YEAR,T1._Period),DATEPART(MONTH,T1._Period),1,0,0,0,0,0), T1._Fld79RRef, T1._Fld80RRef, CAST(SUM(T1._Fld81) AS NUMERIC(22, 0)) FROM #tt1 T1 WITH(NOLOCK) GROUP BY DATETIME2FROMPARTS(DATEPART(YEAR,T1._Period),DATEPART(MONTH,T1._Period),1,0,0,0,0,0), T1._Fld79RRef, T1._Fld80RRef<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0438\u0442\u043e\u0433\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0435 \u0438\u0442\u043e\u0433\u0438, \u0447\u0438\u0441\u0442\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p>5.13 \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0421\u0423\u0411\u0414.<\/p>\n<pre><code class=\"sql\">UPDATE T2 SET _Fld81 = T2._Fld81 + T1._Fld81 FROM #tt2 T1 WITH(NOLOCK) INNER JOIN dbo._AccumRgTn83 T2 ON T1._Period = T2._Period AND T1._Fld79RRef = T2._Fld79RRef AND T1._Fld80RRef = T2._Fld80RRef<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#171;AND T2._Splitter = @P1&#187;<\/p>\n<p>5.14 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0435 \u0438\u0442\u043e\u0433\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgTn83 (_Period, _Fld79RRef, _Fld80RRef, _Fld81) SELECT T1._Period, T1._Fld79RRef, T1._Fld80RRef, CAST(T1._Fld81 AS NUMERIC(16, 0)) FROM #tt2 T1 WITH(NOLOCK) LEFT OUTER JOIN dbo._AccumRgTn83 T2 ON T2._Period = T1._Period AND T1._Fld79RRef = T2._Fld79RRef AND T1._Fld80RRef = T2._Fld80RRef WHERE T2._Period IS NULL<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#171;AND T2._Splitter = @P1&#187; <\/p>\n<p>5.15 \u0427\u0438\u0441\u0442\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt2<\/code><\/pre>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt1<\/code><\/pre>\n<p>5.16 \u0424\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">COMMIT TRANSACTION<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 (5.4) \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (5.1-5.4) \u0438 \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (5.16).<\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u0430, \u0438\u043b\u0438 \u043d\u043e\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u043a\u0438(\u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u0435\u0441\u0442\u0430\u043c\u0438), \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b (5.1-5.6) \u0438 \u0444\u0438\u043a\u0441\u0430\u0446\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 (5.16). \u0415\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u043f\u0435\u0440\u0438\u043e\u0434, \u043d\u0430 \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0442\u043e\u0433\u0438.<\/p>\n<h3>\u041e\u0431\u043e\u0440\u043e\u0442\u044b, \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0440\u0435\u0436\u0438\u043c \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432<\/h3>\n<p>\u0420\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 = \u041b\u043e\u0436\u044c; \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u041b\u043e\u0436\u044c);<\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u043a\u0430\u043a \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0438\u0442\u043e\u0433\u043e\u0432: \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438<\/summary>\n<div class=\"spoiler__content\">\n<p>6.1 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION<\/code><\/pre>\n<p>6.2 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0421\u0423\u0411\u0414<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._UseTotals, T1._ActualPeriod, T1._UseSplitter, T1._MinPeriod, T1._MinCalculatedPeriod FROM dbo._AccumRgOpt94 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<p>6.3 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443<\/p>\n<pre><code class=\"sql\">SELECT TOP 1 T1._LineNo, T1._Active FROM dbo._AccumRg78 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo DESC <\/code><\/pre>\n<p>6.4 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432<\/p>\n<pre><code class=\"sql\">SELECT T1._AggMode, T1._EnableUse, T1._FillStartDate, T1._FillEndDate, T1._DeltaPeriodic, T1._BufferPeriodic, T1._State FROM dbo._AccumRgAggOptK85 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043e\u0441\u0442\u0430\u0432 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u0430\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.<\/p>\n<p>6.5 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt1') IS NOT NULL <\/code><\/pre>\n<p>6.6 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0421\u043e\u0441\u0442\u0430\u0432 \u043f\u043e\u043b\u0435\u0439 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u0430\u043a \u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt1 (_Period DATETIME2(0), _RecorderRRef BINARY(16), _LineNo NUMERIC(9, 0), _Active BINARY(1), _Fld79RRef BINARY(16), _Fld80RRef BINARY(16), _Fld81 NUMERIC(10, 0), _Fld82 NVARCHAR(10) COLLATE DATABASE_DEFAULT) <\/code><\/pre>\n<p>6.7 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt1 (_Period,_RecorderRRef,_LineNo,_Active,_Fld79RRef,_Fld80RRef,_Fld81,_Fld82)  VALUES(@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8) <\/code><\/pre>\n<p>6.8 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt2') IS NOT NULL <\/code><\/pre>\n<p>6.9 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt2 (_Period DATETIME2(0), _Fld79RRef BINARY(16), _Fld80RRef BINARY(16), _Fld81 NUMERIC(16, 0)) <\/code><\/pre>\n<p>6.10 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441.<\/p>\n<pre><code class=\"sql\">CREATE CLUSTERED INDEX idx2 ON #tt2 (_Period, _Fld79RRef, _Fld80RRef) <\/code><\/pre>\n<p>6.11 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0437\u0430\u043f\u0438\u0441\u0438, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0443 \u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u043c.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt2 WITH(TABLOCK) (_Period, _Fld79RRef, _Fld80RRef, _Fld81) SELECT DATETIME2FROMPARTS(DATEPART(YEAR,T1._Period),DATEPART(MONTH,T1._Period),DATEPART(DAY,T1._Period),0,0,0,0,0), T1._Fld79RRef, T1._Fld80RRef, CAST(SUM(T1._Fld81) AS NUMERIC(16, 0)) FROM #tt1 T1 WITH(NOLOCK) GROUP BY DATETIME2FROMPARTS(DATEPART(YEAR,T1._Period),DATEPART(MONTH,T1._Period),DATEPART(DAY,T1._Period),0,0,0,0,0), T1._Fld79RRef, T1._Fld80RRef <\/code><\/pre>\n<p>6.12 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u043e\u0432\u044b\u0445 \u043e\u0431\u043e\u0440\u043e\u0442\u043e\u0432.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgDlK88 (_Period, _Fld79RRef, _Fld80RRef, _Fld81) SELECT T1._Period, T1._Fld79RRef, T1._Fld80RRef, T1._Fld81 FROM #tt2 T1 WITH(NOLOCK) <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435 &#171;_Splitter&#187;<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgDlK69 (_Period, _Fld59RRef, _Fld60RRef, _Fld61, _Splitter) SELECT T1._Period, T1._Fld59RRef, T1._Fld60RRef, T1._Fld61, CAST(@P1 AS NUMERIC(10, 0)) FROM #tt2 T1 WITH(NOLOCK)<\/code><\/pre>\n<p>6.13 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRg78 (_Period, _RecorderRRef, _LineNo, _Active, _Fld79RRef, _Fld80RRef, _Fld81, _Fld82) SELECT T1._Period, T1._RecorderRRef, T1._LineNo, T1._Active, T1._Fld79RRef, T1._Fld80RRef, T1._Fld81, T1._Fld82 FROM #tt1 T1 WITH(NOLOCK) <\/code><\/pre>\n<p>6.14 \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. <\/p>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt1<\/code><\/pre>\n<p>6.15 \u0424\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">COMMIT TRANSACTION<\/code><\/pre>\n<p>6.16 \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/p>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt2 <\/code><\/pre>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0431\u043e\u0440\u043e\u0442\u043e\u0432 \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0440\u0430\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432. \u0412\u043e \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u0442\u043e\u0433\u0438, \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0442\u043e\u0433\u043e\u0432. \u0414\u043b\u044f \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0438 \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<h3>\u041e\u0431\u043e\u0440\u043e\u0442\u044b, \u0441 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c, \u0440\u0435\u0436\u0438\u043c \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432<\/h3>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432 \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043a\u0430\u043a \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0438\u0442\u043e\u0433\u043e\u0432: \u0432\u043d\u043e\u0441\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u0434\u0435\u043b\u044c\u0442\u043e\u0439 \u0438 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u043e\u0432\u044b\u0445 \u043e\u0431\u043e\u0440\u043e\u0442\u043e\u0432.<\/p>\n<p>\u0420\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 - \"\u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b\"; \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u0418\u0441\u0442\u0438\u043d\u0430);<\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<details class=\"spoiler\">\n<summary>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0435<\/summary>\n<div class=\"spoiler__content\">\n<p>7.1 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION<\/code><\/pre>\n<p>7.2 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0421\u0423\u0411\u0414.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._UseTotals, T1._ActualPeriod, T1._UseSplitter, T1._MinPeriod, T1._MinCalculatedPeriod FROM dbo._AccumRgOpt94 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<p>7.3 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._RecorderRRef, T1._LineNo, T1._Active, T1._Fld79RRef, T1._Fld80RRef, T1._Fld81, T1._Fld82 FROM dbo._AccumRg78 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo<\/code><\/pre>\n<p>7.4 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0436\u0438\u043c\u0430 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432.<\/p>\n<pre><code class=\"sql\">SELECT T1._AggMode, T1._EnableUse, T1._FillStartDate, T1._FillEndDate, T1._DeltaPeriodic, T1._BufferPeriodic, T1._State FROM dbo._AccumRgAggOptK85 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<p>7.5 \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435.<\/p>\n<pre><code class=\"sql\">DELETE FROM T1 FROM dbo._AccumRg78 T1 WHERE T1._RecorderRRef = @P1 AND ((T1._LineNo >= @P2 AND T1._LineNo &lt; @P3))<\/code><\/pre>\n<p>7.6 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRg78 (_Period,_RecorderRRef,_LineNo,_Active,_Fld79RRef,_Fld80RRef,_Fld81,_Fld82)  VALUES(@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p>7.7 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt1') IS NOT NULL<\/code><\/pre>\n<p>7.8 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt1 (_Period DATETIME2(0), _Fld79RRef BINARY(16), _Fld80RRef BINARY(16), _Fld81 NUMERIC(16, 0)) <\/code><\/pre>\n<p>7.9 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt1 (_Period,_Fld79RRef,_Fld80RRef,_Fld81) VALUES(@P1,@P2,@P3,@P4)<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441, \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u0438 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u043c \u0437\u043d\u0430\u043a\u043e\u043c, \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u043d\u0430\u043a \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>7.10 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt2') IS NOT NULL<\/code><\/pre>\n<p> 7.11 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt2 (_Period DATETIME2(0), _Fld79RRef BINARY(16), _Fld80RRef BINARY(16), _Fld81 NUMERIC(22, 0))<\/code><\/pre>\n<p>7.12 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441.<\/p>\n<pre><code class=\"sql\">CREATE CLUSTERED INDEX idx2 ON #tt2 (_Period, _Fld79RRef, _Fld80RRef) <\/code><\/pre>\n<p>7.13 \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt2 WITH(TABLOCK) (_Period, _Fld79RRef, _Fld80RRef, _Fld81) SELECT DATETIME2FROMPARTS(DATEPART(YEAR,T1._Period),DATEPART(MONTH,T1._Period),DATEPART(DAY,T1._Period),0,0,0,0,0), T1._Fld79RRef, T1._Fld80RRef, CAST(SUM(T1._Fld81) AS NUMERIC(22, 0)) FROM #tt1 T1 WITH(NOLOCK) GROUP BY DATETIME2FROMPARTS(DATEPART(YEAR,T1._Period),DATEPART(MONTH,T1._Period),DATEPART(DAY,T1._Period),0,0,0,0,0), T1._Fld79RRef, T1._Fld80RRef <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u043e\u0431\u043e\u0440\u043e\u0442\u044b, \u0447\u0438\u0441\u0442\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p>7.14 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u043e\u0432\u044b\u0445 \u043e\u0431\u043e\u0440\u043e\u0442\u043e\u0432.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgDlK88 (_Period, _Fld79RRef, _Fld80RRef, _Fld81) SELECT T1._Period, T1._Fld79RRef, T1._Fld80RRef, CAST(T1._Fld81 AS NUMERIC(16, 0)) FROM #tt2 T1 WITH(NOLOCK) <\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgDlK69 (_Period, _Fld59RRef, _Fld60RRef, _Fld61, _Splitter) SELECT T1._Period, T1._Fld59RRef, T1._Fld60RRef, T1._Fld61, CAST(@P1 AS NUMERIC(10, 0)) FROM #tt2 T1 WITH(NOLOCK)<\/code><\/pre>\n<p>7.15 \u0427\u0438\u0441\u0442\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt1<\/code><\/pre>\n<p>7.16 \u0424\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">COMMIT TRANSACTION<\/code><\/pre>\n<p>7.17 \u0427\u0438\u0441\u0442\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt2<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432: \u0434\u043b\u044f \u043d\u0430\u0431\u043e\u0440\u0430 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442 &#8212; \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u043f\u0435\u0440\u0438\u043e\u0434, \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435, \u0440\u0435\u0441\u0443\u0440\u0441 &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0432\u0435\u0441\u044c \u043f\u0430\u043a\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<h4>\u041e\u0431\u043e\u0440\u043e\u0442\u044b, \u0440\u0435\u0436\u0438\u043c \u0438\u0442\u043e\u0433\u043e\u0432, \u0438\u0442\u043e\u0433\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u044b<\/h4>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0442\u043e\u0433\u0430\u043c\u0438 \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043a\u0430\u043a \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0441 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0442\u043e\u0433\u0430\u043c\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u043c \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/759070\/\"> https:\/\/habr.com\/ru\/articles\/759070\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u2013 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u0445 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0421\u0423\u0411\u0414. \u041a\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0438\u0434\u0430 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430, \u0440\u0435\u0436\u0438\u043c\u0430 \u0437\u0430\u043f\u0438\u0441\u0438, \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043e\u0432? <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0421\u0423\u0411\u0414 \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0438 \u043e\u0431\u043e\u0440\u043e\u0442\u043e\u0432 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432 \u0438 \u0431\u0435\u0437. <\/p>\n<p>\u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435 1\u0421 8.3.23 \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 MSSQL.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u0441\u0435\u0445 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u0430\u044f:<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u2013 \u0441\u0441\u044b\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0440\u0435\u0441\u0443\u0440\u0441 \u2013 \u0447\u0438\u0441\u043b\u043e, \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442 \u2013 \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<h2>\u0420\u0435\u0433\u0438\u0441\u0442\u0440 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432<\/h2>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432, \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0439 \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0430\u0431\u043b\u0438\u0446 SQL \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0417\u0430\u043f\u0438\u0441\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439 = \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u044b\u041d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f.\u041e\u0441\u0442\u0430\u0442\u043a\u0438\u0411\u0435\u0437\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u0418\u0442\u043e\u0433\u043e\u0432.\u0421\u043e\u0437\u0434\u0430\u0442\u044c\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439(); \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0442\u0431\u043e\u0440.\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440.\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c(\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440);   \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 = \u0420\u0435\u0436\u0438\u043c\u0417\u0430\u043f\u0438\u0441\u0438;  \u0417\u0430\u043f\u0438\u0441\u044c = \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c(); \u0417\u0430\u043f\u0438\u0441\u044c.\u041f\u0435\u0440\u0438\u043e\u0434 = \u041f\u0435\u0440\u0438\u043e\u0434; \u0417\u0430\u043f\u0438\u0441\u044c.\u0412\u0438\u0434\u0414\u0432\u0438\u0436\u0435\u043d\u0438\u044f = \u0412\u0438\u0434\u0414\u0432\u0438\u0436\u0435\u043d\u0438\u044f; \u0417\u0430\u043f\u0438\u0441\u044c.\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04351 = \u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04351; \u0417\u0430\u043f\u0438\u0441\u044c.\u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04352 = \u0418\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u04352; \u0417\u0430\u043f\u0438\u0441\u044c.\u0420\u0435\u0441\u0443\u0440\u04411 = 1; \u0417\u0430\u043f\u0438\u0441\u044c.\u0420\u0435\u043a\u0432\u0438\u0437\u0438\u04421 = \"\u0442\u0435\u0441\u0442\";  \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u0417\u0430\u043c\u0435\u0449\u0430\u0442\u044c);<\/code><\/pre>\n<h3>\u041e\u0441\u0442\u0430\u0442\u043a\u0438, \u0431\u0435\u0437 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0438\u0442\u043e\u0433\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b<\/h3>\n<p>\u0420\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 = \u041b\u043e\u0436\u044c; \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u041b\u043e\u0436\u044c);<\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<p>1.1 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION<\/code><\/pre>\n<p>1.2 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0421\u0423\u0411\u0414, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u0442\u043e\u0433\u043e\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._UseTotals, T1._ActualPeriod, T1._UseSplitter, T1._MinPeriod, T1._MinCalculatedPeriod FROM dbo._AccumRgOpt93 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<p>1.3 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443.<\/p>\n<pre><code class=\"sql\">SELECT TOP 1 T1._LineNo, T1._Active FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo DESC<\/code><\/pre>\n<p>1.4 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRg72 (_Period,_RecorderRRef,_LineNo,_Active,_RecordKind,_Fld73RRef,_Fld74RRef,_Fld75,_Fld76)  VALUES(@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9)<\/code><\/pre>\n<p>1.5 \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0442\u043e\u0433\u043e\u0432. \u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u0442\u043e\u0433\u0430\u0445 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0445 \u0438\u0442\u043e\u0433\u043e\u0432(\u043a\u043e\u043d\u0435\u0446 \u043c\u0435\u0441\u044f\u0446\u0430) \u0438 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<pre><code class=\"sql\">UPDATE T1 SET _Fld75 = T1._Fld75 + @P1 FROM dbo._AccumRgT77 T1 WHERE T1._Period = @P2 AND T1._Fld73RRef = @P3 AND T1._Fld74RRef = @P4<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0432 \u0431\u043b\u043e\u043a \u043e\u0442\u0431\u043e\u0440\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043f\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044e &#171;AND T1._Splitter = @P5&#187;.  \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0435\u043c\u0443 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432.<\/p>\n<pre><code class=\"sql\">UPDATE T1 SET _Fld55 = T1._Fld55 + @P1 FROM dbo._AccumRgT57 T1 WHERE T1._Period = @P2 AND T1._Fld53RRef = @P3 AND T1._Fld54RRef = @P4 AND T1._Splitter = @P5<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0441 \u0432\u0438\u0434\u043e\u043c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0434 \u0440\u0435\u0441\u0443\u0440\u0441 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u043c \u0437\u043d\u0430\u043a\u043e\u043c(T1._Fld75 + -@P1).<\/p>\n<p>1.6 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0442\u043e\u0433\u043e\u0432. \u0414\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0435\u0441\u043b\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0438\u0442\u043e\u0433\u043e\u0432 \u043d\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043f\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u043c \u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0443 \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgT77 (_Period,_Fld73RRef,_Fld74RRef,_Fld75)  VALUES(@P1,@P2,@P3,@P4)<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0435 &#171;_Splitter&#187;.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgT57 (_Period,_Fld53RRef,_Fld54RRef,_Fld55,_Splitter)  VALUES(@P1,@P2,@P3,@P4,@P5)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>1.7 \u0424\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">COMMIT TRANSACTION<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0431\u0435\u0437 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0431\u0435\u0437 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439 \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443, \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441 1.3. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._RecorderRRef, T1._LineNo, T1._Active, T1._RecordKind, T1._Fld73RRef, T1._Fld74RRef, T1._Fld75, T1._Fld76 FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u041e\u0441\u0442\u0430\u0442\u043a\u0438, \u0441 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u043c, \u0438\u0442\u043e\u0433\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b<\/h3>\n<p>\u0420\u0435\u0436\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"1c\">\u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u041e\u0431\u043c\u0435\u043d\u0414\u0430\u043d\u043d\u044b\u043c\u0438.\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 - \"\u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u044b\"; \u041d\u0430\u0431\u043e\u0440\u0417\u0430\u043f\u0438\u0441\u0435\u0439.\u0417\u0430\u043f\u0438\u0441\u0430\u0442\u044c(\u0418\u0441\u0442\u0438\u043d\u0430);<\/code><\/pre>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:<\/p>\n<p>2.1 \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">BEGIN TRANSACTION<\/code><\/pre>\n<p>2.2 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0421\u0423\u0411\u0414, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0438\u0442\u043e\u0433\u043e\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u0417\u0430\u043f\u0440\u043e\u0441 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u0430\u043a 1.2<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"sql\">SELECT T1._Period, T1._UseTotals, T1._ActualPeriod, T1._UseSplitter, T1._MinPeriod, T1._MinCalculatedPeriod FROM dbo._AccumRgOpt93 T1 WHERE T1._RegID = @P1<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>2.3 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043e\u0442\u0431\u043e\u0440\u043e\u043c \u043f\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443.<\/p>\n<pre><code class=\"sql\">SELECT T1._Period, T1._RecorderRRef, T1._LineNo, T1._Active, T1._RecordKind, T1._Fld73RRef, T1._Fld74RRef, T1._Fld75, T1._Fld76 FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 ORDER BY T1._LineNo<\/code><\/pre>\n<p>2.4 \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435. \u0415\u0441\u043b\u0438 \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435, \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<pre><code class=\"sql\">DELETE FROM T1 FROM dbo._AccumRg72 T1 WHERE T1._RecorderRRef = @P1 AND ((T1._LineNo >= @P2 AND T1._LineNo &lt; @P3))<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043e\u0442\u0431\u043e\u0440\u0430:<\/p>\n<pre><code class=\"sql\">WHERE T1._RecorderRRef = @P1 AND ((T1._LineNo = @P2))<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u0443\u0434\u0430\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u043d\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443<\/p>\n<pre><code class=\"sql\">WHERE T1._RecorderRRef = @P1 AND ((T1._LineNo >= @P2 AND T1._LineNo &lt; @P3) OR (T1._LineNo >= @P4 AND T1._LineNo &lt; @P5)) <\/code><\/pre>\n<p>2.5 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a, \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u0438 \u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRg72 (_Period,_RecorderRRef,_LineNo,_Active,_RecordKind,_Fld73RRef,_Fld74RRef,_Fld75,_Fld76)  VALUES(@P1,@P2,@P3,@P4,@P5,@P6,@P7,@P8,@P9)<\/code><\/pre>\n<p>2.6 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt1') IS NOT NULL<\/code><\/pre>\n<p>2.7 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt1 (_Period DATETIME2(0), _RecordKind NUMERIC(1, 0), _Fld73RRef BINARY(16), _Fld74RRef BINARY(16), _Fld75 NUMERIC(16, 0))<\/code><\/pre>\n<p>2.8 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt1 (_Period,_RecordKind,_Fld73RRef,_Fld74RRef,_Fld75)  VALUES(@P1,@P2,@P3,@P4,@P5)<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u0430 \u043f\u043e\u043b\u0435\u0439 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f+\u043f\u0435\u0440\u0438\u043e\u0434 \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0440\u0435\u0441\u0443\u0440\u0441 \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u041f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0437\u043d\u0430\u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0438\u0434\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u0438 \u044d\u0442\u043e \u043d\u043e\u0432\u0430\u044f \u0438\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c. \u0412 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u044f\u0445 \u0434\u043b\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430 \u0441 \u0432\u0438\u0434\u043e\u043c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0445\u043e\u0434 \u0437\u043d\u0430\u043a \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0440\u0435\u0441\u0443\u0440\u0441 \u0440\u0430\u0441\u0445\u043e\u0434\u0430 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u043c \u0437\u043d\u0430\u043a\u043e\u043c. \u0412 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442: \u043f\u0440\u0438\u0445\u043e\u0434 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u043c \u0437\u043d\u0430\u043a\u043e\u043c, \u0440\u0430\u0441\u0445\u043e\u0434 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. <\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"center\">\u0412\u0438\u0434 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f\/\u0417\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u041d\u043e\u0432\u0430\u044f<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"center\">\u041f\u0440\u0438\u0445\u043e\u0434<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0411\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0417\u043d\u0430\u043a \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"234\" width=\"234\">\n<p align=\"center\">\u0420\u0430\u0441\u0445\u043e\u0434<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0417\u043d\u0430\u043a \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u0411\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0442\u043e\u0433\u0430\u043c\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043b\u044c\u0442\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<p>2.9 \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0435\u0440\u0438\u043e\u0434 \u0438\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT MIN(T1._Period) FROM #tt1 T1 WITH(NOLOCK)<\/code><\/pre>\n<p>2.10 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt2') IS NOT NULL<\/code><\/pre>\n<p>2.11 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt2 (_Period DATETIME2(0))<\/code><\/pre>\n<p>2.12 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441.<\/p>\n<pre><code class=\"sql\">CREATE UNIQUE CLUSTERED INDEX idx4 ON #tt2 (_Period)<\/code><\/pre>\n<p>2.13 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0435\u0440\u0438\u043e\u0434\u044b, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0438\u0442\u043e\u0433\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt2 (_Period) VALUES(@P1)<\/code><\/pre>\n<p>2.14 \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">SELECT 1 WHERE OBJECT_ID('tempdb..#tt3') IS NOT NULL<\/code><\/pre>\n<p>2.15 \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">CREATE TABLE #tt3 (_Period DATETIME2(0), _Fld73RRef BINARY(16), _Fld74RRef BINARY(16), _Fld75 NUMERIC(22, 0))<\/code><\/pre>\n<p>2.16 \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt3 WITH(TABLOCK) (_Period, _Fld73RRef, _Fld74RRef, _Fld75) SELECT T2._Period, T1._Fld73RRef, T1._Fld74RRef, CAST(SUM(CASE WHEN T1._RecordKind = 0.0 THEN T1._Fld75 ELSE -T1._Fld75 END) AS NUMERIC(22, 0)) FROM #tt1 T1 WITH(NOLOCK) INNER JOIN #tt2 T2 WITH(NOLOCK) ON T1._Period &lt; T2._Period GROUP BY T2._Period, T1._Fld73RRef, T1._Fld74RRef<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0433\u0434\u0430 \u0434\u0430\u0442\u0430 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u0442\u044b \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0415\u0441\u043b\u0438 \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u0441 \u0434\u0430\u0442\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0430\u0442\u044b \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0442\u043e\u0433\u043e\u0432, \u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b 2.10-2.13 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442. \u0417\u0430\u043f\u0440\u043e\u0441 2.16 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">INSERT INTO #tt3 WITH(TABLOCK) (_Period, _Fld53RRef, _Fld54RRef, _Fld55) SELECT @P1, T1._Fld53RRef, T1._Fld54RRef, CAST(SUM(CASE WHEN T1._RecordKind = 0.0 THEN T1._Fld55 ELSE -T1._Fld55 END) AS NUMERIC(22, 0)) FROM #tt1 T1 WITH(NOLOCK) GROUP BY T1._Fld53RRef, T1._Fld54RRef <\/code><\/pre>\n<p>\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0438\u0442\u043e\u0433\u043e\u0432.<\/p>\n<\/div>\n<\/details>\n<p>2.17 \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0438\u0442\u043e\u0433\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0421\u0423\u0411\u0414.<\/p>\n<pre><code class=\"sql\">UPDATE T2 SET _Fld75 = T2._Fld75 + T1._Fld75 FROM #tt3 T1 WITH(NOLOCK) INNER JOIN dbo._AccumRgT77 T2 ON T1._Period = T2._Period AND T1._Fld73RRef = T2._Fld73RRef AND T1._Fld74RRef = T2._Fld74RRef<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#171;AND T2._Splitter = @P1&#187;.<\/p>\n<pre><code class=\"sql\">UPDATE T2 SET _Fld55 = T2._Fld55 + T1._Fld55 FROM #tt3 T1 WITH(NOLOCK) INNER JOIN dbo._AccumRgT57 T2 ON T1._Period = T2._Period AND T1._Fld53RRef = T2._Fld53RRef AND T1._Fld54RRef = T2._Fld54RRef AND T2._Splitter = @P1 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>2.18 \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0438\u0435 \u0438\u0442\u043e\u0433\u0438.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgT77 (_Period, _Fld73RRef, _Fld74RRef, _Fld75) SELECT T1._Period, T1._Fld73RRef, T1._Fld74RRef, CAST(T1._Fld75 AS NUMERIC(16, 0)) FROM #tt3 T1 WITH(NOLOCK) LEFT OUTER JOIN dbo._AccumRgT77 T2 ON T2._Period = T1._Period AND T1._Fld73RRef = T2._Fld73RRef AND T1._Fld74RRef = T2._Fld74RRef WHERE T2._Period IS NULL<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0438\u0442\u043e\u0433\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 &#171;AND T2._Splitter = @P1&#187;.<\/p>\n<pre><code class=\"sql\">INSERT INTO dbo._AccumRgT57 (_Period, _Fld53RRef, _Fld54RRef, _Fld55, _Splitter) SELECT T1._Period, T1._Fld53RRef, T1._Fld54RRef, CAST(T1._Fld55 AS NUMERIC(16, 0)), CAST(@P1 AS NUMERIC(10, 0)) FROM #tt2 T1 WITH(NOLOCK) LEFT OUTER JOIN dbo._AccumRgT57 T2 ON T2._Period = T1._Period AND T1._Fld53RRef = T2._Fld53RRef AND T1._Fld54RRef = T2._Fld54RRef AND T2._Splitter = @P2 WHERE T2._Period IS NULL <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>2.19 \u0427\u0438\u0441\u0442\u0438\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt3<\/code><\/pre>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt2<\/code><\/pre>\n<pre><code class=\"sql\">TRUNCATE TABLE #tt1<\/code><\/pre>\n<p>2.20 \u0424\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e.<\/p>\n<pre><code class=\"sql\">COMMIT TRANSACTION<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0438 \u0438\u0445 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f, \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u043e\u0439 <\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-354060","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/354060","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=354060"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/354060\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=354060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=354060"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=354060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}