SQL Server
Welcome to SQL Server section of C# Corner. In this section, you will find various SQL Server related source code samples, articles, tutorials, and tips.


  • Rahul Bansal

    Find The 3rd Or Nth Highest Salary In A Table Via SubQuery

    This article describes how to find the 3rd or Nth highest salary in a table. To find the Nth highest salary, we need to create a table in the database containing some data and to do this use the fo...
    Rahul Bansal Aug 01, 2017
  • Nisarg Upadhyay

    SQL Script To Insert Images, Document In Table

    This script will perform bulk insert of images, documents in table.
    Nisarg Upadhyay Jul 30, 2017
  • Vikrant More

    Statistics And Cost Estimation Internals - Part One

    Incorrect cardinality and Cost Estimation may lead query optimizer to choose inefficient plans which can have a negative impact on the database performance. In this article we are going to look dee...
    Vikrant More Jul 30, 2017
  • Ravi Kiran Chanduri

    Bitwise Operators In SQL

    Bitwise operators in SQL server. Bitwise AND (&) and Bitwise Exclusive OR(^)(Caret symbol use in MS SQL server)
  • Vishal Nayan

    Creating And Managing Stored Procedure In SQL Server 2008

    In this article you will learn how to Create and Manage Stored Procedure in SQL Server 2008.
    Vishal Nayan Jul 27, 2017
  • Vadim Loboda

    Combination Of Id-ParentId And HierarchyId Approaches To Hierarchical Data

    How to combine the Id-ParentId and HierarchyId approaches to keep and fetch the data in hierarchical and alphabetical order.
    Vadim Loboda Jul 26, 2017
  • Ajeet  Malviya

    Delete Duplicate Rows In SQL

    The delete query should delete all duplicate rows except one. The output should be as shown below, after the delete query is executed.
    Ajeet Malviya Jul 25, 2017
  • Vignesh Mani

    Taking Script From Database In SQL Server In Different Mode

    This article explains how to take the script from database in SQL server in a different mode. Normally we take back up our entire database as “.bak, .mdf, .ldf” file but sometimes we need to alter,...
    Vignesh Mani Jul 17, 2017
  • Jayesh  Agrawal

    Create SSRS Drilldown Report

    Create SSRS drill down report, add link enable/disable based on specific condition, adding download links in reports.
    Jayesh Agrawal Jul 17, 2017
  • Anil Jha

    Rename Table And Column Name In SQL Server 2014

    Most of the time, if we have to rename a table or rename a column, we usually drop table and create table again, but with this approach we lose data. This approach may work in a development environ...
    Anil Jha Jul 14, 2017
  • Pankaj Sapkal

    Mirroring Database In SQL Server

    When there is any automatic failure we need another server that will monitor the principal server.
    Pankaj Sapkal Jul 12, 2017
  • Deepak Kaushik

    Creating And Using Azure SQL Server And Azure SQL Database

    This article helps you in creating and using SQL Server and SQL database.
    Deepak Kaushik Jul 09, 2017
  • Vignesh Mani

    Monitoring Our Database When Accessing From Outside Or Applications In SQL Server

    This article explains how to monitor our database when accessing from outside or any other applications in an easy way.
    Vignesh Mani Jul 08, 2017
  • Saravanan V

    The What, When, and How of Indexed Views

    This blogs talks about Indexed Views in SQL Server and the pros and cons of using them.
    Saravanan V Jul 06, 2017
  • Santosh Kumar

    Difference Between Stored Procedure And User Defined Function In SQL Server

    This article describes the differences between Stored Procedures and User Defined Functions in SQL Server.
    Santosh Kumar Jul 06, 2017
  • Yashwant Vishwakarma

    Installing SQL Server vNext On Linux - Part Two

    With the release of Microsoft SQL Server on Linux, it is a huge step towards gaining markets in Database Technologies giving competition to other RDBMS software. Microsoft SQL Server is not only on...
  • Nisarg Upadhyay

    Generate Table Definition In SQL Server Without GUI

    This script will create table definition along with unique key, primary key and indexes.
    Nisarg Upadhyay Jul 04, 2017
  • Saillesh Pawar

    Wild Card Operators In SQL

    This article explains Wild Card Operators in SQL. Wildcard characters can be used in LIKE expressions; the percent sign (%) matches zero or more characters and underscore (_) a single character.
    Saillesh Pawar Jun 28, 2017
  • Thiruppathi R

    Convert Table Column Into C# Model Class

    In this blog, I will demonstrate how to convert a table column in C# model class, using stored procedure.
    Thiruppathi R Jun 27, 2017
  • Nisarg Upadhyay

    How To Fix Error - "The Instance ID 'MSSQLSERVER' Is Already In Use By SQL Server Instance 'MSSQL...

    In this blog, you will learn how to fix the error - "The Instance ID 'MSSQLSERVER' Is Already In Use By SQL Server Instance 'MSSQLSERVER.INACTIVE'.
    Nisarg Upadhyay Jun 27, 2017
  • Nisarg Upadhyay

    How To Read SQL T-Log File

    Using this function, we can get a list of all transactions performed in the database. Function name is fn_dblog() (Formally known as DBCC command).
    Nisarg Upadhyay Jun 27, 2017
  • Jasminder Singh

    Row Number Function in SQL Server

    This article explains the row number function in SQL Server. Ranking functions provide a very good feature of assigning numbering to the records in the result set in SQL. Row_Number is one of these...
    Jasminder Singh Jun 27, 2017
  • Jasminder Singh

    Rank Function in SQL Server

    This article explains the Rank function. Ranking functions provide a very good feature of assigning numbering to the records in the result set in SQL. Row_Number is one of these functions available...
    Jasminder Singh Jun 27, 2017
  • Venkatesan Jayakantham

    Time datatype in SQL Server 2008

    Time data type is a one of the new data type introduced in SQL Server 2008. It provided you the time with the accuracy of 100 nanoseconds.
  • Abhijit  Patil

    Indexes in SQL Server

    This article describes indexes in SQL Server. Indexes are used in relational databases to quickly retrieve the data.
    Abhijit Patil Jun 26, 2017