Stored Procs - WHERE Active='Y' END Remove Employee ( and...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
SQL Stored Procedures Murach, Chapter 14
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Stored Procedures (aka, Procs) A stored procedure is one or more SQL and procedural commands that you save in the database for future use. CREATE PROC proc_name EXEC proc_name parameter list DROP PROC proc_name
Background image of page 2
Create Syntax CREATE PROC proc name input/output parameter definitions AS BEGIN code END
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5% Pay Raise CREATE PROC spPayRaise AS BEGIN UPDATE tblEmployee SET AnnualSalary=ROUND(1.05*AnnualSalary,2)
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: WHERE Active='Y' END Remove Employee ( and family/paychecks ) CREATE PROC spDiscardEmployee @EID Varchar(20) AS BEGIN DELETE tblPaycheck WHERE EID=@EID DELETE tblFamily WHERE EID=@EID DELETE tblEmployee WHERE EID=@EID END Using Procs EXEC proc_name parameter_list EXEC spPayRaise EXEC spDiscardEmployee 'MT26' EXEC spDiscardEmployee 'OMP' Object Explorer...
View Full Document

Page1 / 7

Stored Procs - WHERE Active='Y' END Remove Employee ( and...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online