AdventureWorks
HumanResources.uspUpdateEmployeeLogin Stored Procedure
Description
Updates the Employee table with the values specified in the input parameters for the given EmployeeID.
Properties
Creation Date08/01/2010 08:41
Encrypted
Ansi Nulls
Parameters
ParameterDirectionDescriptionData TypeSize
@EmployeeIDInInput parameter for the stored procedure uspUpdateEmployeeLogin. Enter a valid EmployeeID from the Employee table.int4
@ManagerIDInInput parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a valid ManagerID for the employee.int4
@LoginIDInInput parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a valid login for the employee.nvarchar256
@TitleInInput parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a title for the employee.nvarchar50
@HireDateInInput parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a hire date for the employee.datetime4
@CurrentFlagInInput parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter the current flag for the employee.dbo.Flag1
@RETURN_VALUEReturn Value int4
Objects that HumanResources.uspUpdateEmployeeLogin depends on
 Database ObjectObject TypeDescriptionDep Level
Person.Contact tablePerson.ContactTableNames of each employee, customer contact, and vendor contact.2
HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.1
dbo.ErrorLog tabledbo.ErrorLogTableAudit table tracking errors in the the AdventureWorks database that are caught by the CATCH block of a TRY...CATCH construct. Data is inserted by stored procedure dbo.uspLogError when it is executed from inside the CATCH block of a TRY...CATCH construct.2
dbo.Flag datatypedbo.FlagUser Defined Data Type 1
dbo.Name datatypedbo.NameUser Defined Data Type 3
dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 3
dbo.Phone datatypedbo.PhoneUser Defined Data Type 3
dbo.uspLogError proceduredbo.uspLogErrorStored ProcedureLogs error information in the ErrorLog table about the error that caused execution to jump to the CATCH block of a TRY...CATCH construct. Should be executed from within the scope of a CATCH block otherwise it will return without inserting error information.1
dbo.uspPrintError proceduredbo.uspPrintErrorStored ProcedurePrints error information about the error that caused execution to jump to the CATCH block of a TRY...CATCH construct. Should be executed from within the scope of a CATCH block otherwise it will return without printing any error information.2
Procedure Source Code
CREATE PROCEDURE [HumanResources].[uspUpdateEmployeeLogin]
@EmployeeID [int], 
@ManagerID [int],
@LoginID [nvarchar](256),
@Title [nvarchar](50),
@HireDate [datetime],
@CurrentFlag [dbo].[Flag]
WITH EXECUTE AS CALLER
AS

BEGIN
SET NOCOUNT ON;
BEGIN TRY
UPDATE [HumanResources].[Employee] 
SET [ManagerID] = @ManagerID 
,[LoginID] = @LoginID 
,[Title] = @Title 
,[HireDate] = @HireDate 
,[CurrentFlag] = @CurrentFlag 
WHERE [EmployeeID] = @EmployeeID;
END TRY
BEGIN CATCH
EXECUTE [dbo].[uspLogError];
END CATCH;
END;
See Also

Related Objects

HumanResources Schema
AdventureWorks Database

 

 


© 2012 All Rights Reserved.

Send comments on this topic.