Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1498

Re: Some Doubt

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail
From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Some Doubt
Date Wed, 29 May 2013 22:57:43 +0200
Organization Erland Sommarskog
Lines 31
Message-ID <XnsA1CFE9953D132Yazorman@127.0.0.1> (permalink)
References <0a7b5498-c6dd-422e-a047-2af7466127b1@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
Injection-Info mx05.eternal-september.org; posting-host="78e2ae7e6764121e217a035f19bdb315"; logging-data="10296"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ztjV+VS20+hnbyRMo0S9A"
User-Agent Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32)
Cancel-Lock sha1:pKL1nYyixsAusuIH4JhyWwuIXhI=
Xref csiph.com comp.databases.ms-sqlserver:1498

Show key headers only | View raw


SUBBU N (nsubbu1986@gmail.com) writes:
> Hi Experts,
> here onwards i will some qs regarding only for sqldba.can anyone clarify
> and suggest to me plz 
> 
> I have two databases, based on first db execution sucessful move to
> second, upon second db execution scucessful.. commit the
> transaction..if anything fail roll back transaction from both dbs
> 
> Example: DB1 and DB2
> DB1 has Dept and DB2 has Employee...
> now if dept and Employee data successfull then commit data in both DBs
> else rollback from both DBs..
> 

SET XACT_ABORT ON

BEGIN TRANSACTION

-- Updates here.

COMMIT TRANSACTION

It's important to set XACT_ABORT ON, since this ensure that the transaction
is rolled back in case of an error.

The pattern is the same if you update in one database or in two databases.


-- 
Erland Sommarskog, Stockholm, esquel@sommarskog.se

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Some Doubt SUBBU N <nsubbu1986@gmail.com> - 2013-05-29 00:12 -0700
  Re: Some Doubt Erland Sommarskog <esquel@sommarskog.se> - 2013-05-29 22:57 +0200
  Re: Some Doubt SUBBU N <nsubbu1986@gmail.com> - 2013-05-30 02:40 -0700

csiph-web