Suppose I have two tables. The first key of the first table is the foreign key for another table.
The Member table has its primary key as a foreign key in Member_detail .
Therefore, when I insert a row into the Member table using a stored procedure, I need to get the primary key value to add to the Member_detail table.
One way to use:
SELECT Max(MemberID) FROM Member
Then, passing this Memberid to my Member_detail table, but in the next 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 it.
Can someone give me an example?
Nightknight
source share