Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 SELECT @@IDENTITY Always return 0

Author  Topic 

Amjath
Yak Posting Veteran

66 Posts

Posted - 2007-01-29 : 20:36:00
Hi All,
SELECT @@IDENTITY Always return 0 ??? whats the problem...
previously its working fine....i want the reset the Auto increment value, i saw in 1 site stated that delete all the rows and use tools->database Utility->compact and repair database then after the value reseted but when i newly inserted 1 row and put
SELECT @@IDENTITY it always return me 0

plz help me.

-Amjath

Amjath
Yak Posting Veteran

66 Posts

Posted - 2007-01-29 : 21:28:58
Sorry i problem with my coding...i found it....
before calling SELECT @@IDENTITY i just close the previous connection and open as a new connection for this query, thats the problem.

Thanks All
-Amjath
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-01-29 : 22:43:15
in any case you probably ought to be using scope_identity(), not @@identity.

EDIT: ignore the above. i didn't realize this was the access forum when I posted that.


www.elsasoft.org
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-01-30 : 06:08:12
there's @@identity in access?



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-30 : 06:21:14
"there's @@identity in access?"

Yes, Access 2000 or higher versions support @@identity to retrieve next autonumber value.

See this:
[url]http://msdn2.microsoft.com/en-us/library/ks9f57t0.aspx[/url]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -