Category Archives: SQL Server

This category contains all SQL related articles

Intersection command in SQL Server

This function is used to returns distinct values that are returned by both the query on the left and right sides of the INTERSECT operand. For intersection command, below basic rules must be followed. The number and the order of … Continue reading

Posted in SQL Basic Concepts, SQL Server | Tagged | 31 Comments

Exception handling in SQL Server

SQL server gives the exception/error handling mechanism which is similar to c#, Try..Catch block. In SQL Server, we can write the SQL Statements within the Try block and if any exception occurred control automatically goes to the group of SQL … Continue reading

Posted in Most Imp SQL Concepts, SQL Server, SQL Server Exception handling | Tagged | 31 Comments

While loop in SQL server

While loop in SQL server Introduction In While loop, we set a condition for the repeated execution of a Code block. So we use while loop in SQL Server to repeat execution of a SQL Code block or a SQL Statement … Continue reading

Posted in SQL Basic Concepts, SQL Server, SQL While loop | Tagged , , , | 13 Comments

Deleting Duplicate rows using CTE

Deleting Duplicate rows using CTE Many times we caught in a situation where we have a table where there is no primary or unique column defined in it and rows with duplicate data inserted in the table. In this example … Continue reading

Posted in Interview Questions, SQL Advanced, SQL CTE, SQL Server | Tagged | 26 Comments

Ranking Functions in SQL Server

Ranking Function:- Sometimes we need to provide a Row number to the rows in a table or within a partition. For example, suppose we want to give rank to sales man according to their sales amount in a particular month/year. … Continue reading

Posted in SQL Ranking Function, SQL Server | Tagged , | 30 Comments

Stuff VS Replace function in SQL Server

Stuff VS Replace function Stuff Function This function is used to replace string from the given start position, passed as 2nd argument with string passed as last argument. In Stuff function, 3rd argument defines the number of characters which are … Continue reading

Posted in SQL Basic Concepts, SQL Server | Tagged | 6 Comments

Case Statement/ Expression in SQL Server

Case Statement/ Expression in SQL server  Sometimes we need to get one result output from multiple possible outcomes based on the evaluation of some expression. This expression can be a simple case expression which compares an expression with a set … Continue reading

Posted in Most Imp SQL Concepts, SQL Basic Concepts, SQL Server | Tagged , | 1 Comment

Replication in SQL Server

Replication in SQL Server Introduction Replication in SQL Server is a way of distribution of database and their objects from one master database to one or more recipient databases which can be on the same server or on the remote server. … Continue reading

Posted in SQL Replication, SQL Server | Tagged , | 19 Comments

Log Shipping in SQL Server

Log Shipping in SQL Server Log Shipping Log Shipping in SQL Server is a process of keeping the latest copy of the database of the primary database server on the secondary database server with the help of transaction logs backup. … Continue reading

Posted in SQL Log Shipping, SQL Server | Tagged , | Leave a comment

Rebuild And Reorganization of Indexes

Rebuild and  Reorganization of Indexes SQL Server has the ability of maintaining the indexes whenever we makes changes (update, Insert, Delete) in the tables. Over a period of time, the may causes the fragmentation on the table in which  the … Continue reading

Posted in SQL Indexes, SQL Server | Tagged , | 31 Comments