Tuesday, February 21, 2012

SCOPE_IDENTITY( ) in distributed transaction [:S]

i am inserting new record in linked server and i need to get the id (which is of course autonumber) of newly added record. can't i get it using SCOPE_IDENTITY( ) ? SCOPE_IDENTITY( ) seems to be returning null. so SCOPE_IDENTITY( ) doesn't work in distributed transaction?

Hi Keeara,

As far as I know, the SCOPE_IDENTITY() can return the identity in a distributed transaction if the column in the table has been set as an identity.

The column has to be a number or the identity will not be returned.

|||

apparently, it returns NULL. i tried adding record in TEST table in distributed transaction and got NULL.

is there any way to get recently added identity in distributed transaction?

any help will be appreciated.

No comments:

Post a Comment