------------------------------------------------
-- UpdateCustomer
------------------------------------------------
CREATE PROCEDURE UpdateCustomer
@PKId INT = NULL,
@Email NVARCHAR(50) = NULL,
@Password BINARY(24) = NULL,
@Name NVARCHAR(40) = NULL,
@Address NVARCHAR(255) = NULL,
@Country NVARCHAR(40) = NULL,
@PhoneNumber NVARCHAR(30) = NULL,
@Fax NVARCHAR(30) = NULL
AS
SET XACT_ABORT ON
BEGIN TRANSACTION
-- Update customer address by CustomerId
EXEC UpdateCustomerAddress @PKId,
@Address,
@Country,
@PhoneNumber,
@Fax
-- Update customers table with new customer info
UPDATE Customers
SET Email = @Email,
Password = @Password,
Name = @Name
WHERE PKId = @PKId
COMMIT TRANSACTION
RETURN 0
------------------------------------------------
-- unique index on Customers (PKId)
------------------------------------------------
GO