473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

select @@identity

375 256MB
Hi,

I have a table emp1 where i have two fields empno and empname. I have not assigned primary keys to any of these. After inserting values when I put on
select @@identity or
select @@identity from emp1

I always get the answer as NULL. Whereas it should return the maximum number of rows.

What could be the problem.
Kindly let me know.


Regards
cmrhema
Jul 15 '08 #1
3 1735
ck9663
2,878 Expert 2GB
You're looking for COUNT(*) not @@identity.

-- CK
Jul 15 '08 #2
cmrhema
375 256MB
Thanks for the reply, after reading carefully I found that we should have a field that has an autonumber set to it.

I did not do that

Thanks for the reply

regards
cmrhema
Jul 16 '08 #3
ck9663
2,878 Expert 2GB
Then, that's IDENTITY.

-- CK
Jul 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: brent.ryan | last post by:
How do I get the next int value for a column before I do an insert in MY SQL Server 2000? I'm currently using Oracle sequence and doing something like: select seq.nextval from dual; Then I...
2
by: Karthik.S | last post by:
Does DB2 have a select @@ identity equivalent. Karthik
17
by: Trevor Best | last post by:
I don't know if this has been reported before but it appears to be a bug with Access. If I create two tables both with an identity column then create an insert trigger on table1 that inserts a...
1
by: Liming | last post by:
Hello all, I have a need to use "select @@identity" to get the autoid on the row that I just inserted. The insert store procedure executed correctly as if I took out the transaction, i can see...
2
by: Banski | last post by:
Hi, Im trying to use SELECT @@IDENTITY in a transaction. But it always returns 0. Im using an ms access database. And using the following code. What am i doing wrong? Best regards banski ...
3
by: Dan | last post by:
I'm writing a record from an asp.net page to SQL Server. After the insert I'm selecting @@identity to return the ID of the record that I just wrote. It worked fine until I typed a semicolon into...
7
by: Brian | last post by:
Hello all - I am trying to Insert a new record to an Access 2002 database. Following the insert, I need to obtain the primary key of the inserted row (person_ID) which is an Autonumber field. I...
4
by: nsikkandar | last post by:
Greetings, I am in need of getting "Auto Generated Number" of Primary Key from master table (I am, using Access) when I insert a row through ADO.NET from VB.NET. Based on this ID, I want to...
13
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.