views:

25

answers:

1

The way I want my stored procedure to work is this, the user passes all of the customer data, name, phone, and all of address info into the procedure, then I want to perform an insert into the address table, get the id generated from that insert, use that id in another insert for the customer table then return the customer id to the user on the app side. Is this possible within the same stored procedure or is it highly against standards and what do you suggest?

+2  A: 

Yes it's possible, but personally I'd compartmentalize this with separate procedures for the Address and Customer tables. This should give you greater flexibility and more opportunities for code reuse in the future.

Joe Stefanelli
Unless it an atomic write to 2 tables, no?
gbn