Just keeping you on your toes Boss!

-----Original Message-----
From: Andy Ewings [mailto:[EMAIL PROTECTED]]
Sent: 21 May 2002 15:18
To: CF-Talk
Subject: RE: Query help


almost!............

instead of SELECT @@identity = @id you need SELECT @id = @@identity 

-----Original Message-----
From: Stephen Galligan [mailto:[EMAIL PROTECTED]]
Sent: 21 May 2002 15:14
To: CF-Talk
Subject: RE: Query help


Kris,
In your Stored Proc you can use one of SQL's own variables @@identity to get
the row id for the record you have just inserted.  Simply assign @@identity
to a local var et voil�!

HTH
Stephen

DECLARE @id as int

INSERT INTO tableFoo (Col1,Col2,Col3)
VALUES (a,b,c)

SELECT @@identity = @id
SELECT @id


-----Original Message-----
From: Kris Pilles [mailto:[EMAIL PROTECTED]]
Sent: 21 May 2002 14:06
To: CF-Talk
Subject: Query help


How can Insert a record into a table (that I know how to do) but after
the insert, I want to be able to know what the primary key for the
record I just inserted...  



______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to