The select output table auto-increment is processed by a temporary table.

Source: Internet
Author: User

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, expires, expires, 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, expires
, BYZD9, BYZD10, BYZD11, BYZD12, BYZD13, BYZD14, BYZD15, mxbh)
SELECT * FROM #

SET XACT_ABORT ON
BEGIN TRAN
If object_id ('tempdb .. # t') is not null drop table # t
SELECT '1r120720082410' as djbh, MIBH = IDENTITY (INT,), 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 = '000000' 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.