Hi Kirk,
You should be able to do this.
Have your SP return 0 if the record already exists, or the identity of the newly inserted record.
AL
>I'm rewriting some code and trying to move a method of code into a stored procedure. Currently, in my code:
>
>1. Check to see if item exists in table, using a stored procedure. (Select LocationID from coLocatins where locationCode=?lcLocationCode)
>2. If reccount()=0, then build code to insert record and run code to get the ID automaticly assigned @@Identity
>
>
>I'd like to be able to write one stored procedure that ran the select, if the result set was zero, insert a record based on the code I search for and then return that record back to me.
>
>Thanks for any advice
>
>Kirk
Al Williams
Anola MB, CANADA