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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how do I retrieve indexed field's value on insert?

Author  Topic 

goldan
Starting Member

2 Posts

Posted - 2005-07-28 : 16:31:05
I'm creating a multiple page form that will save information to a record as the user moves from page to page. The first page will create the record, and the others will add to that record. How do I create the record then retrieve the value for the indexed field? I will need this in order to append to that record the information obtained in the rest of the pages. TIA.

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2005-07-28 : 17:07:44
You can use SELECT @@IDENTITY which will return the last inserted seeded index. Is that what you need?

Tim
Go to Top of Page

goldan
Starting Member

2 Posts

Posted - 2005-07-28 : 17:47:50
I think so. I'm sure the form I'm making won't be so busy that @@IDENTITY won't work. Thanks.
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2005-07-28 : 17:54:13
You could always hold all the info in session variable(s) then save it at the last minute....
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2005-07-29 : 08:51:30
@@IDENTITY gives you the last inserted index on that DB. You should really use SCOPE_IDENTITY(). This will give you the last inserted Identity in the current scope.

*need more coffee*
SELECT * FROM Users WHERE CLUE > 0
(0 row(s) affected)
Go to Top of Page
   

- Advertisement -