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:3327
Subscription: http://www.houseoffusion.com/groups/sql/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/sql/unsubscribe.cfm

Reply via email to