All posts by Codereview

#Sql Server interview question: What is a ROLLUP Clause?

The ROLLUP clause is used to do aggregate operations on multiple levels in hierarchy. Continue reading #Sql Server interview question: What is a ROLLUP Clause?

#SqlServer interview question: What is ROW_NUMBER()?

ROW_NUMBER() returns a column as an expression that contains the row’s number within the result set. This is only a number used in the context of the result set; if the result changes, the ROW_NUMBER() will change.

Thanks for reading this article,

Next steps :

  1. Share this with your colleagues because Sharing  is Learning
  2. Comment below if you need any assistance

Powered by CodeReview – Let’s make it Better!

#SqlServer interview question: What is Change Data Capture (CDC) in SQL Server 2008?

Another innovative feature in SQL Server 2008 is Change Data Capture (abbreviated as CDC). The concept is similar to Change Tracking but with a major difference.

CDC tracks every field in your table(s) – not just the primary key fields. Change Data Capture (CDC) records INSERTs, UPDATEs, and DELETEs applied to SQL Server tables and makes a record available of what changed, where, and when. Continue reading #SqlServer interview question: What is Change Data Capture (CDC) in SQL Server 2008?

SQL Server Management Studio scripting on TSQL commands

Scenario

With SQL Server Management Studio you have the ability to do just about everything you can do using T-SQL commands.  One problem with using the GUI is that it is difficult to remember everything you clicked on to reproduce the behavior a second time.  Another issue is that most of what you do through the GUI is done immediately which may not always be the best scenario.  How can I capture what SQL Server is doing so I can reproduce the behavior or run the commands at a later time.

Solution

A nice addition to SQL Server Management Studio is the ability to script out most of the commands and operations that you can do through the GUI.  Let’s take a look at doing a database backup as an example.  Continue reading SQL Server Management Studio scripting on TSQL commands

#SqlServer interview question: What are ranking functions?

Ranking functions return a ranking value for each row in a partition. All the ranking functions are non-deterministic. Each of the ranking functions also needs the OVER( ) clause.

The different ranking functions are as follows: Continue reading #SqlServer interview question: What are ranking functions?