开发者

Is it possible to use two SCOPE_IDENTITY calls in the same procedure?

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 possib开发者_如何学编程le within the same stored procedure or is it highly against standards and what do you suggest?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜