UPDATE
  taCase AS CA
SET
  CaseType = @aCaseType,
  ClientID = @nClientID,
  ExternalCaseID = @aExternalCaseID,
  CreatedByID = @nCreatedByID,
  CaseForumID = @nCaseForumID,
  OpposingParty = @aOpposingParty,
  RepresentativeID = @nRepresentativeID,
  Created = IF((TRIM(@dCreated) = ''), CA.Created, UNIX_TIMESTAMP(@dCreated)),
  CaseDiarisedDate = UNIX_TIMESTAMP(@dCaseDiarisedDate),
  CaseSetdownDate = UNIX_TIMESTAMP(@dCaseSetdownDate),
  ContactFirstName = @aContactFirstName,
  ContactSurname = @aContactSurname,
  ContactTitle = @aContactTitle,
  ContactEmail = @aContactEmail,
  ContactAreaCode = @aContactAreaCode,
  ContactTelephone = CONCAT(@aContactTelA, @aContactTelB),
  ClientOrderNumber = @aClientOrderNumber,
  AllocatedConsultantID = @nAllocatedConsultantID,
  LabourNetBranchID = @nLabourNetBranchID,
  LitigationRepID = @nLitigationRepID,
  AssignedToID = @nAssignedToID,
  ClientBranchID = @nClientBranchID,
  CaseCategoryID = @nCaseCategoryID,
  CaseStatusID = @nCaseStatusID
WHERE
  CaseID = @nCaseID