티스토리 뷰

🌈 MsSql

begin tran

James Wetzel 2020. 2. 21. 17:53
728x90
반응형

begin tran

insert into SDFSDF (
cj_invoice_id
, contract_no
, original_invoice_number
, renewal_invoice_number
) values (
@cj_invoice_id
, @contract_no
, @original_invoice_number
, @renewal_invoice_number
)

if @@ERROR <> 0 and @@ROWCOUNT <> 1
begin
   if @@TRANCOUNT > 0
   rollback tran
   return
end

insert into CJF (
contract_no
, renewal_invoice_number
, state_code
) values (
@contract_no
, @renewal_invoice_number
, 'C1'
)

if @@ERROR <> 0 and @@ROWCOUNT <> 1
begin
   if @@TRANCOUNT > 0
   rollback tran
   return
end

commit tran

728x90
반응형