Suppose I have two table. First table's primary key is the foreign key for another table.
Table Member has its primary key as the foreign key in Member_detail.
So when I insert a row in Member table using a Stored Procedure, I need to get the primary key value to add to the Member_detail table.
One way I was using is :
SELECT Max(MemberID)
FROM Member
Then passing this Memberid to my Member_detail table, but on the following post, I read that the Max function is not recommended and that I should use SCOPE_IDENTITY, but I don't know how to use of it.
Can anyone give me some example?