Unfolding | Set Based Approach | Get Continuous Start Date of the Current Project – Episode 8 1
In this video, we are going to learn;
- How and when to use Apply operator in SQL Server, and
- How to compare rows on a given logic
You can download the script used in this example from below the video.
/****************************************************************************************************************************************************** Start using the SetBasedApproach database ******************************************************************************************************************************************************/ --Start using the existing database SetBasedApproach which has been already created in this series USE SetBasedApproach GO /****************************************************************************************************************************************************** Create required objects ******************************************************************************************************************************************************/ --Drop the EmployeeMaster table if it exists already in the database IF(OBJECT_ID('dbo.EmployeeMaster') IS NOT NULL) DROP TABLE dbo.EmployeeMaster --Create Employee master table CREATE TABLE dbo.EmployeeMaster ( EmpID INT NOT NULL PRIMARY KEY, EmpName NVARCHAR(255) NOT NULL ) --Drop the project master table if it exists already in the database IF(OBJECT_ID('dbo.ProjectMaster') IS NOT NULL) DROP TABLE dbo.ProjectMaster --Create project master table CREATE TABLE dbo.ProjectMaster ( ProjectID INT NOT NULL PRIMARY KEY, ProjectName VARCHAR(255) ) --Drop the EmployeeProjectDetail table if it exists already… More