/* -------------------------------------------------------------------------
   Jade Cheng
   ICS 321 Assignment 3
   December 12, 2008

   PART 1.2
   Provide the script that will create a stored procedure that will select
   the identifier and names of all personnel authorized to issue badges. Use
   the person name function.  Name the stored procedure
   authorizedBadgeIssue.
   ------------------------------------------------------------------------- */

USE DB9975
GO

CREATE PROCEDURE authorizedBadgeIssue AS
	SELECT
		dbo.PersonName(PersonId) AS PersonName,
		PersonId
	FROM PERSON_PROFILE
	JOIN PERSON ON PersonId = PERSON.Id
	WHERE ProfileId = 'Scty'
	ORDER BY PersonName
GO

EXECUTE authorizedBadgeIssue
GO
