Click here to Skip to main content
15,916,842 members
Home / Discussions / Database
   

Database

 
AnswerRe: Format Column Pin
okkishore25-Jul-07 20:39
okkishore25-Jul-07 20:39 
QuestionXml and Xls as Data for SSRS [modified] Pin
Katusha260125-Jul-07 2:16
Katusha260125-Jul-07 2:16 
Questionproblem in Take Data Offline Using Microsoft Synchronization Services for ADO.NET Pin
Vikas Shirsath25-Jul-07 1:55
Vikas Shirsath25-Jul-07 1:55 
Questionstored procedure Pin
Dhyanga25-Jul-07 1:48
Dhyanga25-Jul-07 1:48 
AnswerRe: stored procedure Pin
Pete O'Hanlon25-Jul-07 1:57
mvePete O'Hanlon25-Jul-07 1:57 
AnswerRe: stored procedure Ans for Que Pin
Vikas Shirsath25-Jul-07 2:02
Vikas Shirsath25-Jul-07 2:02 
QuestionSimple Begin-Commit-Rollback Transaction Pin
dabuskol25-Jul-07 1:37
dabuskol25-Jul-07 1:37 
AnswerRe: Simple Begin-Commit-Rollback Transaction Pin
Pete O'Hanlon25-Jul-07 1:53
mvePete O'Hanlon25-Jul-07 1:53 
The second @@TRANCOUNT statement is a problem. Basically, the @@Trancount tells you the active number of connections that are present on the connection.

COMMIT TRANSACTION decrements the transaction count, so if you have 1 active transaction before the commit, you have 0 active transactions after. As you can see, this is where your problem occurs - you are testing @@TRANCOUNT <> 1 to call rollback transaction when it is now 0. In otherwords, the rollback will always be attempted.

I would be tempted to rewrite this section as:
Insert Into nnccdtrequestDetail
(Requestno,RequestItemNo,DetailStatus)
select @NEWKEY,RequestItemNo,DetailStatus from nnccdtrequestdetail
Where RequestNo = @TMPKEY

IF @@ERROR = 0
BEGIN
-- There is no error here.
IF @@TRANCOUNT = 1
BEGIN
COMMIT TRANSACTION
END
END
ELSE
BEGIN
-- If I reach this point, there has been an error.
IF @@TRANCOUNT = 1
BEGIN
ROLLBACK TRANSACTION 
END
END
Actually, I would normally not use the @@TRANCOUNT method because I match BEGIN TRANSACTION statements with the relevant closing transaction statements.

Deja View - the feeling that you've seen this post before.

GeneralRe: Simple Begin-Commit-Rollback Transaction Pin
Mike Dimmick25-Jul-07 3:49
Mike Dimmick25-Jul-07 3:49 
GeneralRe: Simple Begin-Commit-Rollback Transaction [modified] Pin
Pete O'Hanlon25-Jul-07 4:26
mvePete O'Hanlon25-Jul-07 4:26 
Question[Message Deleted] Pin
okkishore25-Jul-07 1:27
okkishore25-Jul-07 1:27 
AnswerRe: database recovery. Pin
originSH25-Jul-07 1:34
originSH25-Jul-07 1:34 
GeneralRe: database recovery. Pin
originSH25-Jul-07 2:48
originSH25-Jul-07 2:48 
GeneralRe: database recovery. Pin
Paul Conrad25-Jul-07 9:49
professionalPaul Conrad25-Jul-07 9:49 
AnswerRe: database recovery. Pin
Paul Conrad25-Jul-07 9:51
professionalPaul Conrad25-Jul-07 9:51 
Questiondeleting duplicate rows Pin
okkishore25-Jul-07 1:13
okkishore25-Jul-07 1:13 
AnswerRe: deleting duplicate rows Pin
kubben25-Jul-07 2:01
kubben25-Jul-07 2:01 
GeneralRe: deleting duplicate rows Pin
okkishore25-Jul-07 2:13
okkishore25-Jul-07 2:13 
GeneralRe: deleting duplicate rows Pin
kubben25-Jul-07 2:17
kubben25-Jul-07 2:17 
GeneralRe: deleting duplicate rows Pin
okkishore25-Jul-07 2:25
okkishore25-Jul-07 2:25 
GeneralRe: deleting duplicate rows Pin
kubben25-Jul-07 2:34
kubben25-Jul-07 2:34 
QuestionHow to insert large amount of data into column of a table Pin
yuvachandra25-Jul-07 0:47
yuvachandra25-Jul-07 0:47 
AnswerRe: How to insert large amount of data into column of a table Pin
originSH25-Jul-07 0:54
originSH25-Jul-07 0:54 
QuestionRe: How to insert large amount of data into column of a table Pin
chandragupta.k25-Jul-07 1:39
chandragupta.k25-Jul-07 1:39 
AnswerRe: How to insert large amount of data into column of a table Pin
Pete O'Hanlon25-Jul-07 1:07
mvePete O'Hanlon25-Jul-07 1:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.