In this session we will discuss about CURSORS in sql.
https://drive.google.com/drive/u/2/fo...
-- Cursors in SQL Server
-- Cursor is a db object that retrieves data from result set row by row at at time.
-- we use cursors when we need to update/delete/insert in singleton fashion (row by row)
-- uses to perform dml operations in particular criteria
-- use cursors when ever its necessary
-- Cursors are very poor performance so use wisely
--The life cycle of a cursor can be divided into five phases, as follows:
--Declare Cursor
--DECLARE cursor_name CURSOR FOR
-- SELECT column1, column2, ...
-- FROM table_name
-- WHERE condition;
--Open Cursor -- It allocate memory and ready to perform the operation
--OPEN cursor_name;
--Fetch Cursor -- When we put FETCH it will store data into variables
--FETCH cursor_name INTO variable1, variable2, ...;
--Close Cursor
--CLOSE cursor_name;
--Deallocate Cursor
--DEALLOCATE cursor_name;
#sqlserver #cursor #sql #database #dataanalytics #sql #rdmbs #dbms #advancesql #technology #tech2bi