Stored Procedure:
Pre-Compiled set of SQL Statments..
Increases Performance
Reduces Network Traffic
Syntax:
Create Procedure Proc_name(param list)
As
Begin
// SQL Statements
End
Trigger:
Equivalent to event raising, ie, doing certain action based on events like insert, update...
syntax:
create trigger trg_name
As
begin
// sql statements
end
Cursor:
cursors are used when row by row processing is needed.
syntax
DECLARE cur_name CURSOR
FOR
SELECT username
FROM table
OPEN cur_name
FETCH NEXT FROM cur_name
INTO @usrID
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM cur_nmae
INTO @usrID
END
CLOSE cur_name
DEALLOCATE cur_name
No comments:
Post a Comment