
Search In
Sometimes we need to disable trigger on a table especially when performing admin tasks on a table. Following commands provide a quick way to disable all the triggers for a table. Please note
that when we are diabling triggers on a table we will ha
Differences Between IsNull() and Coalesce() Functions?
ISNULL() Function:
1)ISNULL function is regraded as Transact-SQL function.
2)This function is used to replace NULL with the replacement value specified in second argument or from from the input
In SQL while storing or retrieving passwords we need to ensure that it should be in encrypted format.
So for doing that we first need to store it in encrypted form
CREATE PROC [dbo].[uspRegisterUser]
@FirstName VARCHAR(50),
@LastNam
While writing stetaments in SQL we have scenarios where manipulations based on conditions needs to be performed
For doing that we use conditional statements
ALTER proc [dbo].[sp_CheckLeaveAvailability]
@FromDate date,
@ToDate date,
@Empl
This question is asked a lot in interviews, so here some of the methods by which one can get the second highest salary of an employee from a table.
Suppose the Employee is like this
ID
Name
Salary
Table: Employee
1
P
In SQL we have situations where we want to extract date from date time and in particular format
-- Extracting only Date from DateTime Type Column
SELECT N.[ID],N.[Message],N.[LocationID],N.[TargetUserID],N.[Url],CONCAT(U.[FirstName],U.[LastName])
SQL wildcards are used within a table to search for data. Usage of wildcard characters in SQL call for SQL LIKE operator, which enables to hold a comparison between a value and similar values.
Following are the two types of wildcard operators
ROW_NUMBER()
RANK()
DENSE_RANK()
All of these three functions are used to calculate the Id of row but in different way.
I am using the below script for examples
CREATE TABLE Marks
(
SubjectId INT,
Marks INT
)
INSERT INTO Marks VAL
Alias is basically renaming a table temporarily for a sql statement.
The rename is done only for a particular statement is temporory.
ex
The syntax of table alias is as follows
SELECT column1, column2....
FROM table_name AS alias_name
WHERE [con
ROW_NUMBER()
This function is used to assign a unique id to each row returned by the sql query fired.
RANK()
This function is similar to ROW_NUMBER() with the only difference it leaves a gap between the groups i.e this function assi
