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.
An SQL developer got surprised when he learned that he does not have to use cursors to calculate ranks in SQL Server 2008. He can now just use the newly introduced ranking functions. What are the different RANKING functions inside SQL Server 2008 R2 and what are the new functions introduced inside SQL Server 2012?
Notes of Vinod Kumar
This is a give away as a hint. But there are specific differences when it comes to each of these. Can you think of a scenario to use each of them effectively? Hint: Just think of a school and you will find ways of using them. :)
Notes of Pinal Dave
I still remember my first manager and his advice: “Take a walk, when you have to use cursor”. I still remember this and follow it every single time; I just have to use cursor. Cursors are not always bad, but if it is used without proper understanding and without considering other alternatives, it is indeed a bad decision to use. I have often seen cases where there were alternate ready-made solutions available, but still the developer went ahead and implemented a cursor that was not optimized (hogging resources). I personally insist on always learning all the new features of SQL Server as I often figure out alternative of cursors when I am exploring new features.
SQL Server Interview Questions and Answers ISBN: 1466405643 Page#128-129
Use INSERT INTO … SELECT instead of Cursor
Simple Use of Cursor to Print All Stored Procedures of Database
Simple Use of Cursor to Print All Stored Procedures of Database Including Schema
Simple Example of Cursor
Cursor to Kill All Process in Database
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 (https://blog.sqlauthority.com)