
Search In
EXISTS Operator:
Exists operator is a special type of operator which is used in a subquery. It is used to check whether a subquery returns something or not. If a subquery returns some row then outer query get executed otherwise the whole query will
Transaction anywhere is used to execute or stop set of statements.
BEGIN TRANSACTION trans
BEGIN TRY
INSERT INTO Department(DeptID,DeptName,Location)VALUES(2,'HR','Delhi')
INSERT INTO Employee(EmpID,Name,Salary,Address,DeptID)VALUE
We need the latest record that is inserted or updated . For doing that we need to find the latest row that can be done with the help of scope identity
ALTER procedure [dbo].[sp_AddEmployee]
(
@EmpName varchar(80),
@EmpDesgnationId int,
@EmpDob dat
Delete command in SQL removes the ROW based on the condition provided with the WHERE clause, if no WHERE clause is provided it deletes all the row from the table.
Syntax for delete command:
DELETE FROM table_name WHERE column_name='value';
Trunca
While writing Stored Procedures sometimes you need to store multiple columns values of select statement into multiple variables.
For doing that you need to write it in the following way
CREATE PROC dbo.uspDemo
@AccessToken VARCHAR(50),
@B
To check any link or any information or any message is expired or not we always made a column IsExpired in SQL Server.
While accessing this values we always this value is expired or not
SELECT N.ID, N.Message, N.Url, U.FirstName +
While writing queries we use paranthesis while writing Table Name or Column Name
This is so because if you have any keyword used in your column or table no conflict can occur
-- To get User Details
SELECT @TargetUserID=[ID] ,@CompanyID=[C
While extracting specific portion from Date or from Date Time we can use Date Part functions for doing that
-- Declare Variable
Declare @UserID;
--Extracting Day Month and Year
SELECT DATEPART(yyyy,UserCreated) AS UserYear,
DATEPART(mm,Mon
There are number of scenarios where you need to store your password in encrypted form.
While doing that you encrypt it using many techniques like MD5 Hashing etc whatever according to your requirement
When we use SQL encrypt and decrypt passw
While restoring or resetting password you need to ensure a random password always gets generated
for the user every time the request is made.
For doing that we always write a stored procedure to check first that the email id user is enterin
