Tag Archives: Sql Server

SQL Triggers – An Introduction

SQL Triggers – An Introduction Contents Introduction Magic Tables Difference between Stored Procedure and Trigger DML Triggers After Triggers Syntax of the After trigger Example of After Trigger for Insert Example of After Trigger for Delete Example of After Trigger … Continue reading

Posted in Most Imp SQL Concepts, SQL Advanced, SQL Server, SQL Triggers | Tagged , , , , | 33 Comments

Script to find complete months between two given dates

Complete months between two given dates Below script will help in finding the complete months within the 2 given dates. In the below script we takes below dates as exampleStartdate =2015-07-05 Enddate =2016-01-06 /**********************Script Start**************************/ IF (object_id(‘tempdb..#month’) is not null) … Continue reading

Posted in Interview Questions, SQL Basic, SQL Server | Tagged , , | Leave a comment

Script to find the complete weeks within two given dates

Complete weeks within two given dates Sometimes we need to find out the complete weeks within two given dates. Below script will help in finding the complete weeks within 2 given dates. In this script, I have used below dates … Continue reading

Posted in Interview Questions, SQL Basic, SQL Server, SQL Tips | Tagged , | 21 Comments

While loop in SQL server

While loop in SQL server Introduction In While loop, we set a condition for the repeated execution of a Code block. So we use while loop in SQL Server to repeat execution of a SQL Code block or a SQL Statement … Continue reading

Posted in SQL Basic Concepts, SQL Server, SQL While loop | Tagged , , , | 13 Comments