Added: June/02/2005 at 9:21am | IP Logged
|
|
|
I am using Access and would like to be able to get the AutoNumber ID for a record that I add using an INSERT statement. I've tried using:
SELECT @@IDENTITY 'id' INSERT INTO table (column1,column2) VALUES ('val1','val2')
as well as
INSERT INTO table (column1,column2) VALUES ('val1','val2'); SELECT @@IDENTITY
but each time, I get an error. Is there a way to get the ID from a newly inserted record at the time when you perform the insert? I know I could use a couple of sql queries, one after another, but this could cause problems if more than one person inserts data at once.
Chris
|