DK, What would be the difference in this case? I'm looking for the most optimal if at all possible.
Thanks -- Michael Dinowitz On Tue, Apr 20, 2010 at 1:42 PM, DK <[email protected]> wrote: > > The only other tweak I would make is use scope_identity() instead of > @@IDENTITY > > > > ----- Original Message ----- > From: "Michael Dinowitz" <[email protected]> > To: "sql" <[email protected]> > Sent: Tuesday, April 20, 2010 1:29 PM > Subject: Re: query returns data comparison statement > > >> >> OK, other than a few minor tweaks, it works. >> >> create procedure getkeywordid @keyword varchar(100) >> as >> SET NOCOUNT ON; >> >> select keywordid >> from keyword >> where keyword = @keyword >> >> if @@ROWCOUNT <> 1 >> begin >> insert into keywords (keyword) >> values (@keyword) >> >> select keywordid=@@identity >> end >> SET NOCOUNT OFF; >> >> Thanks Carl and DK >> >> -- >> Michael Dinowitz >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/sql/message.cfm/messageid:3328 Subscription: http://www.houseoffusion.com/groups/sql/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/sql/unsubscribe.cfm
