Skip to content
Home » SQL Advance Tutorial » Page 3

SQL Advance Tutorial

SQL Triggers

SQL Server triggers are special kind of Stored Procedures that invokes whenever a special event in the database occurs.

SQL Server uses two virtual tables INSERTED and DELETED, whenever a trigger is called . These table is used to capture the data of the modified row before and after the event occurs  tables , these tables are called as magic tables or virtual tables.

Loading

SQL STUFF

SQL STUFF() function is used to delete a sequence of given length of characters from a string and inserting the given sequence of characters from the specified starting index.

Syntax

STUFF(String, Start, Length, Newstring)

String – It is the string to be modified.

Start  – The starting index from where the given length of characters will be deleted and new sequence of characters will be inserted.

Length -The number of characters to delete from string

Loading

SQL TRANSLATE()

 The SQL TRANSLATE() is a string function that is used to replaces a sequence of characters in a string with another sequence of characters.

The function replaces a single character at a time.  Until SQL Server 2016, we used use REPLACE() function to replace each character.

Loading

What is Correlated Subquery in SQL?

A correlated subquery is a subquery that uses the values of the outer query  and it is evaluated for each row processed by the outer query 

A correlated subquery  always depends on outer query for its value. Because of this dependency, a correlated subquery cannot be executed independently as a simple subquery .

Loading