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.


  • Understanding Foreign Key Through GUI In SQL Server

    In this video tutorial, we will learn how we can create a Foreign Key in a child table referencing its parent table. And, we will try to understand the concept of foreign keys through GUI.
  • Use Of DISTINCT Keyword In T-SQL (SQL Server)

    In this session of SQL Server Training series, we are going to learn how to use Distinct keyword in SQL Server.
  • Creating A Database In SQL Server 2017 - A Quick Recap

    In this video session, we will quickly walk through the steps of creating a simple Database in SQL Server 2017 Express Edition.
  • Create Unique Key Constraint Through GUI In SQL Server

    Learn how to create a Unique Key Constraint in SQL Server through GUI without writing any T-SQL query.
  • Making Custom Function Deterministic With SCHEMABINDING And Its Impact On DB Objects

    In this video, we will learn to make custom functions or User-Defined Functions in SQL Server Deterministic by using the "SCHEMABINDING" keyword.
  • Creating Computed Columns With User Defined Functions

    In this video, we are going to learn about adding a computed column by using a user-defined function, also known as Custom Function. --Create a function (NON DETERMINISTIC) CREATE FUNCTION [dbo].[MyFunc] (@val int) RETURNS int AS BEGIN RETURN @val*2; END --Test the function select dbo.myFunc (200); -- should give output: 400-- Add a computed column using ALTER TABLE query ALTER TABLE jobs ADD double_salary AS dbo.myFunc(salary) Go--Get data from table SELECT * FROM jobs--Find if User Defined function is Deterministric SELECT id, Name, OBJECTPROPERTY(id, 'IsDeterministic') AS isDeterministic FROM dbo.SysObjects WHERE XType = 'FN' ORDER BY OBJECTPROPERTY(id, 'IsDeterministic') DESC, Name--Create a deterministic function WITH SCHEMABINDING CREATE FUNCTION [dbo].[MyDetFunc] (@val int) RETURNS int WITH SCHEMABINDING AS BEGIN RETURN @val*2; END -- Add a computed column with PERSISTED option ALTER TABLE jobs ADD double_salary2 AS dbo.myDetFunc(salary) persisted Go-- Again Get data from table SELECT * FROM jobs
  • Creating a Computed Column in SQL Server

    Learn to create a Computed Column in SQL Server through Management Studio GUI without writing T-SQL.
  • Generating SELECT (JOIN) Query Through Criteria Pane, SQL Pane, and Diagram Pane

    In this training video, we will learn how to generate SELECT (INNER JOIN) Query through Criteria pane, SQL Pane, and Diagram Pane. We will not write query ourselves; instead, we will use SSMS GUI to generate the desired query which would save our Query Writing time and efforts.
  • Dynamic Pivot Table In SQL Server

    In this video , we will learn how to create dynamic pivot table in SQL server in just 10 minutes
  • Introduction To SQL Server Pagination

    In this video, we will look into retrieving records in page wise from SQL Server using OFFSET-FETCH statement.
  • Understanding SQL Server Transparent Data Encryption

    In this video, we will look into the encryption of SQL Server Database using TDE.
  • Introduction To SQL Server Dynamic Data Masking

    In this video, we will discuss SQL Server Dynamic Data Masking feature to hide\mask sensitive data.
  • Look At SQL Server Encryption - Part I

    In this video, we will look at SQL Server encryption followed by a demo where we will encrypt a column in the table.
  • Enabling SQLCLR in SQL2005

    This video shows enabling SQLCLR through, Surface area configuration tool.
  • Creating C# function and Deploying it as SQLServer Function

    This video shows creating a C# function and then deploying it in the SQL Server. After deployment, the function can be used as SQL Server built-in function.
  • Database Mirroring in SQL Server

    This video will give you a detailed explanation on how to configure SQL Server DB Mirroring.
  • Scalar-Valued SQL Function with Parameters

    This video shows writing a Scalar-Valued SQL Function that takes Parameter. The video also walks you through different parameter passing techniques
  • Creating Stored Procedure in SQL Server

    This article explain how to create Stored Procedure in SQL Server.
  • Retrieve Multiple Rows as a Single Record

    A simple way to join tables in order to pivot a multi-row structure on a single-row one
  • Video: Creating a stored procedure and executing it

    The video shows creating a stored procedure and executing it in the Management studio.
  • View More