Year 2011 was a year of learning and opportunity for me. My recent book, SQL Server Interview Questions and Answers, has received such overwhelming love and support from all of you. While writing the book, I had two simple goals: (1) Master the Basics and (2) Ignite Learning. There was a constant request from the Community to take the learning of these books to the next level. Here is an article which discusses the Author’s Perspective.
Beyond Relational has come up with a very interesting concept – they have converted a few of the questions from my book into the SQL Quiz. The quiz is indeed focused on my two goals. In addition, it’s going to put the learning of the book to a higher stage. Looking at this novel concept, Vinod Kumar (Co-author) and I have decided to help every participant and reader by giving a few hints and suggestions to solve the quiz.
I noticed a very long stored procedure in the production database. This database creating temporary tables, using insert and select statement. When I asked the purpose of the stored procedure, I realize they should have just used an OUTPUT clause. What is the OUTPUT clause inside SQL Server?
The feature which got introduced in SQL Server 2005 edition had a lot of scope for usage. UC wrote a great post a while back on this subject on sqltips. Also, try to read more about the composable DML concepts.
When OUTPUT clause was introduced, I was very happy because I do not have to use global functions and temporary tables to accomplish certain tasks as this new clause. The OUTPUT clause has a variety of ways to access inserted and deleted tables (virtual tables). The OUTPUT clause can be used with INSERT, UPDATE, or DELETE to identify the actual rows affected by these statements.
SQL Server Interview Questions and Answers ISBN: 1466405643 Page#63
OUTPUT Clause Example and Explanation with INSERT, UPDATE, DELETE
Note: The SQL Quiz, winners and prizes are administrated by Beyond Relational. The goal of this blog post is to provide additional learning pointers only.
Reference: Pinal Dave (http://blog.sqlauthority.com)