Northwind Database (Document! X Sample)
AdventureWorks Database / HumanResources Schema / HumanResources.uspUpdateEmployeePersonalInfo Stored Procedure
In This Topic
    HumanResources.uspUpdateEmployeePersonalInfo Stored Procedure
    In This Topic
    Description
    Updates the Employee table with the values specified in the input parameters for the given EmployeeID.
    Properties
    Creation Date27/10/2017 14:33
    Encrypted
    Ansi Nulls
    Parameters
    ParameterDirectionDescriptionData TypeSize
    InInput parameter for the stored procedure uspUpdateEmployeePersonalInfo. Enter a valid BusinessEntityID from the HumanResources.Employee table.Integer4
    InInput parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a national ID for the employee.VarWChar15
    InInput parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a birth date for the employee.DBTimeStamp4
    InInput parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a marital status for the employee.VarWChar1
    InInput parameter for the stored procedure uspUpdateEmployeeHireInfo. Enter a gender for the employee.VarWChar1
    Return Value Integer4
    Objects that HumanResources.uspUpdateEmployeePersonalInfo depends on
     Database ObjectObject TypeDescriptionDep Level
    Person.BusinessEntity tablePerson.BusinessEntityTableSource of the ID that connects vendors, customers, and employees with address and contact information.2
    HumanResources.Employee tableHumanResources.EmployeeTableEmployee information such as salary, department, and title.3
    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.3
    dbo.Flag datatypedbo.FlagUser Defined Data Type 4
    dbo.Name datatypedbo.NameUser Defined Data Type 2
    dbo.NameStyle datatypedbo.NameStyleUser Defined Data Type 5
    Person.Person tablePerson.PersonTableHuman beings involved with AdventureWorks: employees, customer contacts, and vendor contacts.4
    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.2
    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].[uspUpdateEmployeePersonalInfo]
        @BusinessEntityID [int], 
        @NationalIDNumber [nvarchar](15), 
        @BirthDate [datetime], 
        @MaritalStatus [nchar](1), 
        @Gender [nchar](1)
    WITH EXECUTE AS CALLER
    AS
    
    BEGIN
        SET NOCOUNT ON;
    
        BEGIN TRY
            UPDATE [HumanResources].[Employee] 
            SET [NationalIDNumber] = @NationalIDNumber 
                ,[BirthDate] = @BirthDate 
                ,[MaritalStatus] = @MaritalStatus 
                ,[Gender] = @Gender 
            WHERE [BusinessEntityID] = @BusinessEntityID;
        END TRY
        BEGIN CATCH
            EXECUTE [dbo].[uspLogError];
        END CATCH;
    END;
    
    See Also