Modifying data stored procedures involves transaction processing.

Source: Internet
Author: User
Alter proc proc_updateinfomation (@ c_id varchar (50), @ State int output)
As
Begin
Declare @ Tran varchar (50)
Set @ State = 0
Begin Tran @ tran
Delete from companyinfo where c_id = @ c_id
If @ error0 or @ rowcount> 1
Begin
Rollback Tran @ tran
Set @ State = 0
End
Delete from enterprisecontent where c_id = @ c_id
If @ error0 or @ rowcount> 1
Begin
Rollback Tran @ tran
Set @ State = 0
End
Insert into companyinfo ([c_id], [companyName], [genderid], [introduce], [logopath], [companypath], [purchaseproduct], [mainproduct], [dealtype], [companytype], [sort], [sortorder], [regmoney], [regtime], [regplace], [companyadderss], [foundtime], [pperson], [limit X], [pdept], [pduty], [paddress], [pzip], [ptel], [pemail], [pPhone], [pmobile], [pfax], [Pqq], [pmsn], [pwebsite], [keyword], [keystarttime], [keyendtime], [addtime], [scores], [award], [ispass], [passtime], [passadmin], [openedmonth], [ispayment], [isdelete]) select [c_id], [companyName], [genderid], [introduce], [logopath], [companypath], [purchaseproduct], [mainproduct], [dealtype], [companytype], [sort], [sortorder], [regmoney], [regtime], [regplace], [companyadderss], [foundtime], [pperson], [partition X], [pdept], [pduty], [paddress], [pzip], [ptel], [pemail], [pPhone], [pmobile], [pfax], [Pqq], [pmsn], [pwebsite], [keyword], [keystarttime], [keyendtime], [addtime], [scores], [award], [ispass], [passtime], [passadmin], [openedmonth], [ispayment], [isdelete] From updatecompanyinfo where c_id = @ c_id
If @ error0 or @ rowcount> 1
Begin
Rollback Tran @ tran
Set @ State = 0
End
Insert into iseisecontent ([c_id], [legalperson], [Worker num], [workernum], [income], [mainmarket], [mainplace], [isoem], [plantarea], [BrandName], [turnover], [import], [Export], [qualitycontrol], [managementsystem], [ourbank], [bankaccount]) select [c_id], [legalperson], [Worker num], [workernum], [income], [mainmarket], [mainplace], [isoem], [plantarea], [BrandName], [turnover], [import], [Export], [qualitycontrol], [managementsystem], [ourbank], [bankaccount] From updatecompanyinfo where c_id = @ c_id
If @ error0 or @ rowcount> 1
Begin
Rollback Tran @ tran
Set @ State = 0
End
Delete from updatecompanyinfo where c_id = @ c_id
If @ error0 or @ rowcount> 1
Begin
Rollback Tran @ tran
Set @ State = 0
End
If @ error = 0 and @ rowcount> 0
Begin
Commit Tran @ tran
Set @ State = 1
End
Else
Begin
Rollback Tran @ tran
Set @ State = 0
End
End
Go

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.