SQL @@IDENTITY

Results 1 to 2 of 2

Thread: SQL @@IDENTITY

  1. #1
    Steve Karsch Guest

    Default SQL @@IDENTITY

    I&#039m trying to use the @@IDENTITY to get the identity of a row I just inserted into my database. I&#039m following the instructions that can be found in the article at http://www.4guysfromrolla.com/webtech/100598-1.shtml<BR>It&#039s still not working, though. Here&#039s the error message I get:<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e14&#039 <BR><BR>[Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in query expression &#039@@IDENTITY&#039. <BR><BR>/part/newentry/sut/business.asp, line 15 <BR><BR>The code I&#039m using is:<BR><BR>Dim rsIdentity<BR><BR>set rsIdentity = DbConn.execute("SELECT @@IDENTITY From Vendors")<BR><BR>This is executed AFTER I execute the INSERT command into the Vendors table.<BR>Can anyone help me out here?<BR><BR>Thanks a lot!<BR>Steve Karsch<BR><BR>karschsp@netscape.net

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: SQL @@IDENTITY

    Steve:<BR><BR>You&#039ll note that the article is titled, "How to obtain the identity value in SQL." I&#039m have no idea if @@IDENTITY works in Access, although I strongly suspect it does not. I am not too familiar with Access, so I don&#039t know if there is an equivalent? Perhaps someone here can help?? :)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •