In Focus
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.


  • Brief Introduction To Indexes In SQL Server

    Here, I will be giving a brief introduction to Indexes in SQL Server and why we need the indexing.
  • SQL Query To Calculate Age Using Given Date Of Birth (DOB)

    Date of Birth can be used to calculate the age in years, months, and days.
  • Improve SQL Query Performance

    In this blog, I will explain how to improve the performance of your SQL query. As a developer, we know any SQL query can be written in multiple ways but we should follow the best practices/techniques to achieve better query performance.
  • How To Find Employees Hired Last Month Or Year In SQL Server

    In this blog, we will understand how we can find employees hired last month or year. We will understand DATEDIFF function in SQL server. The DATEDIFF function is used to calculate the difference between two dates.
  • Different Types Of Clauses In SQL Server

    In this blog, we are going to learn about clauses in SQL Server. Clauses are used with table expressions and help in finding the result.
  • JOIN Tables Without Foreign Key In SQL Server

    In this blog, we will understand how to join two or more SQL tables without using a foreign key. We will also get an overview of Join and Keys in SQL.
  • ASCII Values Of Alphabets And Numbers In SQL Server

    In this blog, we will understand the usage of ASCII function in SQL Server and find ASCII values of capital and small alphabets.
  • Delete Duplicate Record From SQL Database Using CTE

    How to delete duplicate records from a SQL data table using CTE (common table expression). Specifies a temporary named result set, known as a common table expression (CTE).
  • Scalar Function In SQL Server

    This article demonstrates how to create and use a scalar function in the SQL Server database. In this blog, we won't go very far. We will perform only basic functions.
  • Overview Of MSSQL Logs

    Database Logs are used for any modification/transaction on table production or during development from their Database Server.
  • 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 the SQL Server IsNull function, then we will move towards extending the IsNull functionality using Coalesce function.
  • 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.
  • 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.
  • 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.
  • How To Find Random Record In SQL Server

    In this blog. I will explain you how to find random record in SQL server. This is most common interview question. The CHECKSUM function returns the checksum value computed over a table row, or over an expression list. Use CHECKSUM to build hash indexes. A hash index will result if the CHECKSUM function has column arguments, and an index is built over the computed CHECKSUM value. This can be used for equality searches over the columns. SQL NEWID function is used for selecting random row from a result set in SQL Server databases. NEWID is use to assign a value to a variable declared as the uniqueidentifier data type.
  • How To Calculate Time (Years, Months, And Days) Between Two Dates

    In this post, we will learn how to calculate the time between two dates in years, months, and days format. There is a special function for getting a perfect year, month, and day count.
  • Resolving The "Wait Operation Timed Out" Error When TFS Stops Working

    A few days ago our system administrator installed the Microsoft test manager 2012 on Microsoft Team Foundation Server 2010(TFS 2010). Suddenly our TFS stopped working. TFS was not able to extract the data from Database.
  • TRY...CATCH And RAISERROR With Stored Procedure

    In this article, we’ll see how to handle the error and raise an error in SQL Server with a stored procedure.
  • How To Track Changes In Stored Procedure, Function, And View In SQL Server

    SQL Server DDL Trigger is a special kind of trigger that fires in response to Data Definition Language (DDL) statements – CREATE, ALTER, DROP (Table, Function, Index, Stored Procedures, Views.. etc).
  • View More