SELECT DJBH,MIBH,SPDM,GG1DM,GG2DM,SL,SL_1,SL_2,SL_3,BZSL,CKJ,ZK,DJ,DJ_1,DJ_2,DJ_3,JE,JE_1,JE_2,JE_3,BZJE,BZS,HH,DJH,MIH,MXH,DJH_1,MIH_1,
MXH_1,BZ,BYZD1,BYZD2,BYZD3,BYZD4,BYZD5,BYZD6,BYZD7,BYZD8,BYZD9,BYZD10,BYZD11,BYZD12,BYZD13,BYZD14,BYZD15,
MXBH=IDENTITY(INT,1,1) INTO #A FROM BHJRDMX WHERE DJBH='S001_PA1000013'
INSERT INTO PHJRDMX(DJBH,MIBH,SPDM,GG1DM,GG2DM,SL,SL_1,SL_2,SL_3,BZSL,CKJ,ZK,DJ,DJ_1,DJ_2,DJ_3,JE,JE_1,JE_2,JE_3,BZJE,BZS,HH,DJH,MIH,MXH,DJH_1,MIH_1,MXH_1,BZ,BYZD1,BYZD2,BYZD3,BYZD4,BYZD5,BYZD6,BYZD7,BYZD8
,BYZD9,BYZD10,BYZD11,BYZD12,BYZD13,BYZD14,BYZD15, mxbh)
SELECT * FROM #A
SET XACT_ABORT ON
BEGIN TRAN
if object_id('tempdb..#t') is not null drop table #t
SELECT '1R12072001000010' as djbh,MIBH=IDENTITY(INT,1,1),SPDM,GG1DM,GG2DM,SL-SL_1 AS SL,CKJ,ZK,DJ,DJ_1,DJ_2,JE,JE_1,JE_2,BZ,BYZD14,1 MIH_1
into #t FROM PROCESSDJMX
WHERE TBLNAME='DBJRD' AND DJBH='1R11080122000004' AND MIBH=1 AND SPDM='10000004' AND USRID='1'
INSERT INTO DSENDMX (DJBH,MIH_1,SPDM,GG1DM,GG2DM,SL,CKJ,ZK,DJ,DJ_1,DJ_2,JE,JE_1,JE_2,BZ,BYZD14,MIBH)
select DJBH,MIH_1,SPDM,GG1DM,GG2DM,SL,CKJ,ZK,DJ,DJ_1,DJ_2,JE,JE_1,JE_2,BZ,BYZD14,MIBH from #t
COMMIT TRAN