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.


  • Temporary Tables in SQL Server 2012

    In this article, I am going to give a quick overview of temporary tables in SQL Server 2012. local temporary table, global temporary table, drop temporary table.
  • SQL Data Discovery And Classification In SSMS

    Data exploration and documentation can be cumbersome, classifying data can be one of those tedious but necessary things. With the introduction of such things as GDPR there is an ever greater need t...
  • Replace Nulls With Specified Values in SQL Server

    In this article we will see the various ways to replace null values in a table. ISNULL() function, CASE statement, COALESCE() function can be used to replace null values in a SQL Server table.
  • Difference Between Char, Nchar, Varchar and Nvarchar Data Types in SQL Server

    This small article is intended for the audience stuck in their interview when asked for the differences among CHAR, VARCHAR, NCHAR and NVARCHAR data types. CHAR vs VARCHAR, NCHAR vs NVARCHAR, diffe...
  • Understanding Transactions in SQL Server

    This article covers the fundamentals of transactions in T-SQL, from concepts such as understanding what SQL transactions are, to ACID properties, local and distributed transactions, guidelines for ...
  • New Resumable Online Index Create SQL Server 2019

    SQL Server 2019 brings a very exciting new feature that is long overdue. Resumable Online Index Create is one of my favorite new things. This, paired with the Resumable Index Rebuilds introduced wi...
  • User Defined Table Types And Table Valued Parameters

    In this article you will learn about User Defined Table Types and Table-Valued Parameters. The concepts of User-Defined Table Types (UDTTs) and Table-Valued Parameters (TVPs) were introduced in SQL...
  • 50 Important Queries In SQL Server

    In this article you will learn about 50 Important Queries in SQL Server. EXEC sp_helpdb, exec sp_helptext, EXEC sp_updatestats, EXEC sp_MSforeachtable, SQL query for version name of SQL Server, Ena...
  • SQL Server ISNULL() With Multi Column Names

    Many times we come across null values within tables in SQL Server. Null values are the values with no data; that means the data is missing or unknown. In this article, initially we will understand ...
  • Maximum Limit Value For Integer Data Type in SQL Server 2012

    In this article, I described how to calculate the maximum range of various integer data types in SQL Server. TINYINT, SMALLINT, INT and BIGINT are all number data types. The difference between thes...
  • Difference Between Primary key, Unique key And Foreign Key

    In this blog we will learn the basic differences between Primary key, Unique key and Foreign key. Difference between Primary key and Unique key.
  • Diving Into The Basics of SQL Server

    To learn the database, most of the times, we need to build the schema and put some data inside. But to speed up the learning and make the hands dirty in code as soon as possible, large organization...
  • Merging Data Using A Queuing Pattern

    In my recent article Using Materialized Views Effectively, I offered a few ways to populate data stores that can be critical performance-improvers for your apps and BI environments that use SQL Ser...
  • How To Rebuild Master Database In SQL Server Without Backup

    Here, we will discuss the full procedure to rebuild Master Database in SQL Server without unavailability of backup. Read the complete blog very carefully to get appropriate results.
  • SQL Server Management Studio 18.0 Preview 5 Available Now

    Recently, Microsoft has released the Preview 5 of SQL Server Management Studio 18.0. This is the second public preview of SSMS 18.0.
  • Aggregate¬†Function in SQL Server

    In this blog, we will learn about aggregate function in SQL Server. An aggregate function is used to calculate the given values and returns a single value.
  • 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...
  • How Should We Store Images And Blob Files In SQL Server

    There is always a requirement from developers: How should I store images and BLOB files in SQL Server ? In this post let's explore the data types and methods used for storing Binary Large Objec...
  • Pivot And Unpivot In SQL Server

    In this article we will learn how to use pivot and unpivot relational operator in SQL Server.
  • Date And Time Functions In SQL Server

    In this article we learn about Date and time functions in SQL Server.These functions are working on given date and time.These functions are SQL Pre defined functions.
  • Some Common Mistakes When Querying SQL Database

    When I started learning SQL, I found out several issues, which I thought to be interesting to share. For our needs, let us use AdventureWorks2012 database, which can be obtained here.
  • Overview Of Stored Procedure In SQL server

    In this blog, we will discuss how to work with Stored Procedure and explain the concept with an example in a simple way. I hope this is very useful for beginners and intermediate to help them under...
  • How To Return Boolean Values From SQL Server

    Here, I will tell you the possible ways to return calculated Boolean values from SQL Server code. At a lot of places, you want to progress conditionally. You send some input values to the stored pr...
  • Covering Indexes And Filtered Indexes In SQL

    Hello Learners. I hope you all are doing great. This article describes the Covering Indexes and Filtered Indexes. I would like to tell you that these type of Indexes can only be created as NONCLUST...
  • How Much Will Compression Really Gain Me

    Did you know that compression can gain you more than just space on a disk; it can allow you to fit more data into the buffer pool? That means queries have faster and more efficient reads which can ...
  • View More