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
 General SQL Server Forums
 New to SQL Server Programming
 Can a value be retrieved from an insert?

Author  Topic 

fastedge
Starting Member

8 Posts

Posted - 2005-08-12 : 11:11:08
I need to return the "autoID" number that is created at the time of an insert. Is there way of doing that?

Thanks,
Ed

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-12 : 11:14:35
select @@identity

or

select scope_Identity()


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

fastedge
Starting Member

8 Posts

Posted - 2005-08-12 : 11:22:12
I'm sorry. I don't think I worded my question correctly.

I'm inserting a new record which creates an auto generated ID. Can that ID be returned at the time of the insert?

Thanks,
Ed
Go to Top of Page

fastedge
Starting Member

8 Posts

Posted - 2005-08-12 : 11:23:27
Oh wait. That is the answer.
Go to Top of Page

fastedge
Starting Member

8 Posts

Posted - 2005-08-12 : 11:23:49
Awesome! Thanks again.
Go to Top of Page
   

- Advertisement -