@@identity returns Null

  • I have client application (Windows XP, MSDE 2000, ADO, CBuilder 5).

    Program open one ADOConnection when it starts and keep it open until stops. After insertion of a record I ask @@identity. I do it in many points of program. There is one point when I receive @@identity=null, though insertion was done.

    The same action using BDE always give correct value of @@identity.

    It's the first.

    Second:

    I ask CURRENT_USER (Windows 2000 Server, MS SQL SERVER) and receive correct answer.

    The same (Windows XP, MSDE2000) with the same database and client application returns error.

    Can anybody help me? Thanks in advance.

  • You should be using the Scope_Identity() function (assuming you're using SS 2000).

    see: http://www.sqlservercentral.com/columnists/awarren/checkyoursqlserveridentity.asp

Viewing 2 posts - 1 through 1 (of 1 total)

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