Over on Experts Exchange someone asked, once I insert a record into the table, how can I retrieve the primary key that was just inserted. This is a topic I covered back in 2005 in my post SQL 101 – System Functions. In this post I introduced you to @@IDENTITY. If you are unfamiliar with the @@IDENTITY function, please check out my post. This is a very useful technique to master!
This system function will tell you the id that was just created for your previous insert statement. It looks like pollock_d and I were on the same page. Unfortunately, it took a while before the author chose the expert answer. Read through the process it took to get to the solution, It definitely shows how competitive some people are about getting credit for answers on Experts Exchange.
So, if you have questions, you’ll certainly get help there!
As for me, as long as you get an answer and understand why the answer works, you’ll learn from it. That’s all that really matters is people learn a new skill in SQL. If you have any questions about SQL, send them in. I’m here to help!