Transaction ID

  • Is there a way to get the unique identifier of a transaction that SQL uses. I know you can name them, but SQL must have another way to identify it.

    Thanks in advance.

  • I don't know of any way to do this. Can I ask why you want it?

    Gary Johnson

    Microsoft Natural Language Group

    DBA, Sr. DB Engineer




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

  • I think @@spid will provide u the identifier

  • Hm...not sure if this is what you want, but a look at BOL for LSN might be helpful.

    Frank

    http://www.insidesql.de

    http://www.familienzirkus.de

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • I want to do some audits of changes in the database. I would like to do this using triggers, but there will be updates to several tables in one transaction and I would like to be able to group all those updates in my audit tables.

    quote:


    I don't know of any way to do this. Can I ask why you want it?

    Gary Johnson

    Microsoft Natural Language Group

    DBA, Sr. DB Engineer


  • I believe this information is in the sysprocesses table in the master database under the fiels "SID". But its a binary datatype so you'll have to do some digging to get the information you want.


    -Isaiah

  • Are you able to modify the code that is being used to update the tables? If so, you'd be a lot better of doing this explicitely, using some set based processing.

    If not, then this is real tricky. If you're trying to group your audit updates by connection then @@spid will be all you need.

    Signature is NULL

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply