Стал разбираться глубже, что происходит при исполнении запроса.
Код: Выделить всё
exec sp_executesql N'DECLARE @CurDT DATETIME, @AtlDate INT, @AtlTime INT
SELECT @CurDT=GETDATE()
SELECT @AtlDate=dbo.ToAtlDate(@CurDT), @AtlTime=dbo.ToAtlTime(@CurDT)
INSERT INTO T$KATSOPR(F$ATL_LASTUSER,F$ATL_OWNER,F$ATL_BRANCH,F$ATL_ORIGINOFFICE,F$ATL_LASTDATE,F$ATL_LASTTIME,F$NREC,F$FILIALNO,F$NAME,F$DESCR,F$DESGR,F$CORG,F$SUMMA,F$CVAL,F$SUMVAL,F$VHODNAL,F$DPRICE,F$CCOMPL,F$KOLKOMPL,F$RNDR,F$RNDV,F$CNAZNA,F$CDOGOVOR,F$CAPPDOGOVOR,F$CCALPLAN,F$CPERSON,F$CDOVER,F$NDOVER,F$DDOVER,F$SDOVER,F$CDOVFIO,F$STATUS,F$CNOTE,F$CPAYMENT,F$CTRANSP,F$NVAGON,F$NKVIT,F$NSERTIF,F$CMASED,F$CMASVID,F$NETTO,F$MTARA,F$CSTEPDOC,F$TIPSOPR,F$DSOPR,F$YEARSOPR,F$NSOPR,F$VIDSOPR,F$CPODRFROM,F$CPODRTO,F$CMOLFROM,F$CMOLTO,F$CGRUZFROM,F$CGRUZTO,F$CORGBASE,F$DOPR,F$CHOZOPER,F$SOPRHOZ,F$RESERVED,F$SROKRES,F$CKATSOPR,F$CVALUT,F$CSCHFACT,F$USERFIELD,F$CGRSOPR,F$SNALOGS,F$SVNALOGS,F$TRANSP,F$CNZAKAZ,F$COTGORDER,F$WADOC,F$CADOC,F$CIZD,F$WCIZD,F$CZAKAZ,F$CPRICEALG,F$TYPEDOC,F$CCELLVAL,F$CNMOVECELL,F$TARAVOZ,F$CORGPLAT,F$TIPOTVPODR,F$COTVPODR,F$CUKS,F$CADOC,F$CAPPDOGOVOR,F$CCALPLAN,F$CCELLVAL,F$CCOMPL,F$CDOGOVOR,F$CDOVER,F$CDOVFIO,F$CGRSOPR,F$CGRUZFROM,F$CGRUZTO,F$CHOZOPER,F$CIZD,F$CKATSOPR,F$CMASED,F$CMASVID,F$CMOLFROM,F$CMOLTO,F$CNAZNA,F$CNMOVECELL,F$CNOTE,F$CNZAKAZ,F$CORG,F$CORGBASE,F$CORGPLAT,F$COTGORDER,F$COTVPODR,F$CPAYMENT,F$CPERSON,F$CPODRFROM,F$CPODRTO,F$CPRICEALG,F$CSCHFACT,F$CSTEPDOC,F$CTRANSP,F$CUKS,F$CVAL,F$CVALUT,F$CZAKAZ,F$DDOVER,F$DESCR,F$DESGR,F$DOPR,F$DPRICE,F$DSOPR,F$FILIALNO,F$KOLKOMPL,F$MTARA,F$NAME,F$NDOVER,F$NETTO,F$NKVIT,F$NSERTIF,F$NSOPR,F$NVAGON,F$RESERVED,F$RNDR,F$RNDV,F$SDOVER,F$SNALOGS,F$SOPRHOZ,F$SROKRES,F$STATUS,F$SUMMA,F$SUMVAL,F$SVNALOGS,F$TARAVOZ,F$TIPOTVPODR,F$TIPSOPR,F$TRANSP,F$TYPEDOC,F$USERFIELD,F$VHODNAL,F$VIDSOPR,F$WADOC,F$WCIZD,F$YEARSOPR) (SELECT @P1,@P2,@P3,@P4,@AtlDate,@AtlTime,@P5,@P6,@P7,@P8,@P9,@P10,@P11,@P12,@P13,@P14,@P15,@P16,@P17,@P18,@P19,@P20,@P21,@P22,@P23,@P24,@P25,@P26,@P27,@P28,@P29,@P30,@P31,@P32,@P33,@P34,@P35,@P36,@P37,@P38,@P39,@P40,@P41,@P42,@P43,@P44,@P45,@P46,@P47,@P48,@P49,@P50,@P51,@P52,@P53,@P54,@P55,@P56,@P57,@P58,@P59,@P60,@P61,@P62,@P63,@P64,@P65,@P66,@P67,@P68,@P69,@P70,@P71,@P72,@P73,@P74,@P75,@P76,@P77,@P78,@P79,@P80,@P81,@P82,@P83,@P84,@P85,@P86,@P87,@P88,@P89,@P90,@P91,@P92,@P93,@P94,@P95,@P96,@P97,@P98,@P99,@P100,@P101,@P102,@P103,@P104,@P105,@P106,@P107,@P108,@P109,@P110,@P111,@P112,@P113,@P114,@P115,@P116,@P117,@P118,@P119,@P120,@P121,@P122,@P123,@P124,@P125,@P126,@P127,@P128,@P129,@P130,@P131,@P132,@P133,@P134,@P135,@P136,@P137,@P138,@P139,@P140,@P141,@P142,@P143,@P144,@P145,@P146,@P147,@P148,@P149,@P150,@P151,@P152,@P153,@P154,@P155,@P156,@P157,@P158,@P159 FROM T$KATSOPR WHERE F$NREC=@P160)
IF @@ERROR=0 AND @@ROWCOUNT>0 SELECT Sys#UL FROM T$KATSOPR WHERE F$NREC=@P161',N'@P1 binary(8),@P2 binary(8),@P3 binary(8),@P4 int,@P5 binary(8),@P6 int,@P7 varchar(81),@P8 varchar(21),@P9 varchar(5),@P10 binary(8),@P11 float,@P12 binary(8),@P13 float,@P14 int,@P15 int,@P16 binary(8),@P17 float,@P18 float,@P19 float,@P20 binary(8),@P21 binary(8),@P22 binary(8),@P23 binary(8),@P24 binary(8),@P25 binary(8),@P26 varchar(21),@P27 int,@P28 varchar(81),@P29 binary(8),@P30 int,@P31 binary(8),@P32 binary(8),@P33 binary(8),@P34 varchar(21),@P35 varchar(21),@P36 varchar(21),@P37 binary(8),@P38 binary(8),@P39 float,@P40 float,@P41 binary(8),@P42 int,@P43 int,@P44 int,@P45 varchar(41),@P46 int,@P47 binary(8),@P48 binary(8),@P49 binary(8),@P50 binary(8),@P51 binary(8),@P52 binary(8),@P53 binary(8),@P54 int,@P55 binary(8),@P56 int,@P57 int,@P58 int,@P59 binary(8),@P60 binary(8),@P61 binary(8),@P62 varchar(81),@P63 binary(8),@P64 float,@P65 float,@P66 int,@P67 binary(8),@P68 binary(8),@P69 int,@P70 binary(8),@P71 binary(8),@P72 int,@P73 binary(8),@P74 binary(8),@P75 int,@P76 binary(8),@P77 binary(8),@P78 int,@P79 binary(8),@P80 int,@P81 binary(8),@P82 binary(8),@P83 binary(8),@P84 binary(8),@P85 binary(8),@P86 binary(8),@P87 binary(8),@P88 binary(8),@P89 binary(8),@P90 binary(8),@P91 binary(8),@P92 binary(8),@P93 binary(8),@P94 binary(8),@P95 binary(8),@P96 binary(8),@P97 binary(8),@P98 binary(8),@P99 binary(8),@P100 binary(8),@P101 binary(8),@P102 binary(8),@P103 binary(8),@P104 binary(8),@P105 binary(8),@P106 binary(8),@P107 binary(8),@P108 binary(8),@P109 binary(8),@P110 binary(8),@P111 binary(8),@P112 binary(8),@P113 binary(8),@P114 binary(8),@P115 binary(8),@P116 binary(8),@P117 binary(8),@P118 binary(8),@P119 binary(8),@P120 binary(8),@P121 binary(8),@P122 int,@P123 varchar(21),@P124 varchar(5),@P125 int,@P126 int,@P127 int,@P128 int,@P129 float,@P130 float,@P131 varchar(81),@P132 varchar(21),@P133 float,@P134 varchar(21),@P135 varchar(21),@P136 varchar(41),@P137 varchar(21),@P138 int,@P139 float,@P140 float,@P141 varchar(81),@P142 float,@P143 int,@P144 int,@P145 int,@P146 float,@P147 float,@P148 float,@P149 int,@P150 int,@P151 int,@P152 int,@P153 int,@P154 varchar(81),@P155 int,@P156 int,@P157 int,@P158 int,@P159 int,@P160 binary(8),@P161 binary(8)',0x8001000000000367,0x8001000000000367,0x8001000000000002,1,0x800100000003E41A,0,' ДO № 03-228 от 04/10/2007','MAL','ZAK',0x80010000000017B2,14,0x8000000000000000,0,2,131533316,0x8000000000000000,0,0,0,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,' ',0,' ',0x8000000000000000,1,0x8000000000000003,0x8000000000000000,0x8000000000000000,' ',' ',' ',0x8000000000000000,0x8000000000000000,0,0,0x8001000000001F0D,1,131533316,2007,'03-228',101,0x8000000000000000,0x800100000000036E,0x8000000000000000,0x8000000000000000,0x80010000000017B2,0x80010000000017B9,0x80010000000017B2,131533316,0x80010000000001B5,0,0,0,0x8000000000000000,0x8000000000000000,0x8000000000000000,' ',0x8000000000000000,0,0,0,0x8000000000000000,0x8000000000000000,0,0x8000000000000000,0x8000000000000000,0,0x8000000000000000,0x8000000000000000,0,0x8000000000000000,0x8000000000000000,2,0x80010000000010F1,0,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x800A000000000003,0x80010000000017B9,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000003,0x8000000000000000,0x800A000000000003,0x800A000000000003,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8001000000000001,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0x8000000000000000,0,'ZVE','CHT',0,131924487,131924487,0,0,0,' ',' ',0,' ',' ','017782',' ',0,0,0,' ',0,0,0,0,0,0,0,0,0,1,0,0,' ',2,101,0,0,2013,0x80010000000033AE,0x800100000003E41A
При выполнении его получился список описанных в первом сообщении ошибок.