>Is there a way to make it return a value if the id is already in the >database?
How about: declare @tableId int select @tableId = tableid from table where someotherID=#arguments.someotherID# if @tableId is null begin insert into table ( someotherId ) values ( #arguments.someotherID# ) set @tableId = @@IDENTITY end select @tableId as tableId Sixten ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:250081 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4