Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
T-SQL
»
Getting Transaction ID
Getting Transaction ID
Rate Topic
Display Mode
Topic Options
Author
Message
felipe-462297
felipe-462297
Posted Monday, February 11, 2008 12:25 PM
Forum Newbie
Group: General Forum Members
Last Login: Monday, April 14, 2008 7:57 AM
Points: 2,
Visits: 12
How can I get the Transaction ID inside "BEGIN...COMMIT" commands?
Thank you.
Felipe Melo
Post #454021
Jeff Moden
Jeff Moden
Posted Monday, February 11, 2008 7:25 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Yesterday @ 9:57 PM
Points: 32,893,
Visits: 26,771
WHAT do you mean by "Transaction ID"? Do you mean the level of nesting within the transaction or do you mean the IDENTITY number of a row you just inserted into a table that has an IDENTITY column?
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #454192
felipe-462297
felipe-462297
Posted Tuesday, February 12, 2008 6:14 AM
Forum Newbie
Group: General Forum Members
Last Login: Monday, April 14, 2008 7:57 AM
Points: 2,
Visits: 12
Hi Jeff,
Please corrrect if I'm making any mistake, but I think SQL creates an unique ID to each opened transaction.
If it exist, I need to get this ID number.
Thank you for your reply.
Post #454365
Nic Hopper-586355
Nic Hopper-586355
Posted Tuesday, February 12, 2008 6:32 AM
Say Hey Kid
Group: General Forum Members
Last Login: Thursday, August 28, 2008 3:13 AM
Points: 707,
Visits: 194
Thats an interesting question, as far as i was aware transaction where managed at the session id, db and object id level.
All this information should be in syslocks, or you could return the session id from @@Spid.
Would interested to know if there is a unique transaction id or guid that is visible and not just internal to SQL.
Post #454377
Jeff Moden
Jeff Moden
Posted Tuesday, February 12, 2008 7:22 AM
SSC-Dedicated
Group: General Forum Members
Last Login: Yesterday @ 9:57 PM
Points: 32,893,
Visits: 26,771
felipe (2/12/2008)
Hi Jeff,
Please corrrect if I'm making any mistake, but I think SQL creates an unique ID to each opened transaction.
If it exist, I need to get this ID number.
Thank you for your reply.
That may be... but that type of thing would go to the transaction log and that particular "transaction ID" doesn't have a public facing interface function that I know of (in plain English... I don't know how to get
that
number using SQL ;) ).
The only number that I know you can get automatically is if the table has an IDENTITY column. Then you can use the SCOPE_IDENTITY() function to return the ID of the row you last inserted... transaction or not.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #454413
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.