[thelist] ASP: @@Identity

Tab Alleman talleman at autobex.com
Mon Nov 13 11:04:44 CST 2000


In case any of you were interested, I got past the problem.  I never got
around to trying Scott's "Roy Rogers" solution.  The actual problem was
connection-limits, apparently.  I was doing this:

<psuedo-code>
Open RS of duplicate records and start looping through it
	Open a RS of this Item (all fields)
		INSERT (all fields) a new record into the table
		Get the @@Identity of the new record
		UPDATE the @@Identity record
	Close RS
Close RS
</psuedo-code>


When I did this instead, it worked:


<psuedo-code>
Open RS of duplicate records and start looping through it
	Make a note of the ID's of the duplicate items
Close RS

FOR EACH item I made a note of
	Open a RS of this Item (all fields)
		INSERT (all fields) a new record into the table
		Get the @@Identity of the new record
		UPDATE the @@Identity record
	Close RS
NEXT
</psuedo-code>

go figure.


-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Scott Dexter
Sent: Friday, November 10, 2000 4:25 PM
To: 'thelist at lists.evolt.org'
Subject: RE: [thelist] ASP: @@Identity


I use a trigger to insert into a second table instead of using @@Identity:

create Trigger tbGroupWWW_Add_tbGTSAudit
On dbo.tbGroupWWW
For Insert
As
Set nocount on
	If Update (uid)
		Begin
			declare @id int
			Select @id=i.uid from inserted i
			Insert into tbGTSAudit(id) values (@id)
		End





More information about the thelist mailing list