• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

SQL query script performance 3

Please do you have any recommendations that I can change on this script?

ALTER TABLE CUSTOMER_HISTORY_TYPE
CHANGE COLUMN history_type_name history_type_display_name varchar(128) NOT NULL,
ADD COLUMN history_type_name varchar(128) NOT NULL;

UPDATE CUSTOMER_HISTORY_TYPE
SET history_type_name =
CASE history_type_display_name
      WHEN 'Successful Login to MyAccount' THEN 'SUCCESSFUL_MYACCOUNT_LOGIN'
      WHEN 'Unsuccessful login to MyAccount' THEN 'FAILED_MYACCOUNT_LOGIN'
      WHEN 'Password change from MyAccount' THEN 'MYACCOUNT_PASSWORD_CHANGE'
      WHEN 'History note added via add_history_form.php' THEN 'NOTE_VIA_ADD_HISTORY_FORM'
      WHEN 'Failed Crediting Card' THEN 'CREDITING_CARD_FAILURE'
      WHEN 'Failed Crediting Bank Account' THEN 'BANK_ACCOUNT_CREDITING_FAILURE'
      WHEN 'Write Off' THEN 'WRITE_OFF'
      WHEN 'Write Off Recovery' THEN 'WRITE_OFF_RECOVERY'
      WHEN 'Pay bill' THEN 'BILL_PAY'
      WHEN 'View balance' THEN 'BALANCE_VIEW'
      WHEN 'Download invoice' THEN 'INVOICE_DOWNLOAD'
      WHEN 'Update credit card' THEN 'CC_UPDATE'
      WHEN 'Update billing address' THEN 'BILLING_ADDR_UPDATE'
      WHEN 'Update payment type' THEN 'PAY_TYPE_UPDATE'
      WHEN 'Upgrade service plan' THEN 'SERVICE_PLAN_UPGRADE'
      WHEN 'Add features' THEN 'FEATURE_ADD'
      WHEN 'Add new account' THEN 'ACCT_ADD'
      WHEN 'Add accessories' THEN 'ACCESSORY_ADD'
      WHEN 'Add internet phone service' THEN 'VOIP_ADD'
      WHEN 'Add secondary numbers' THEN 'SECONDARY_PHONE_ADD'
      WHEN 'Port phone number' THEN 'PORT_PHONE_ADD'
      WHEN 'Update E911 address' THEN 'E911_ADDR_ADD'
      WHEN 'Activate ATA' THEN 'ATA_ACTIVATE'
      WHEN 'View CDRs' THEN 'CDR_VIEW'
      WHEN 'Setup email address' THEN 'EMAIL_ADDR_SETUP'
      WHEN 'Reset password' THEN 'PASSWORD_RESET'
      WHEN 'Reset secret question' THEN 'SECRET_QUESTION_RESET'
      WHEN 'Update day phone number' THEN 'DAY_PHONE_UPDATE'
      WHEN 'Setup web account' THEN 'WEB_ACCT_SETUP'
      WHEN 'Update night phone number' THEN 'NIGHT_PHONE_UPDATE'
      WHEN 'Update account profile/contact email address' THEN 'CONTACT_INFO_UPDATE'
      WHEN 'View Terms of Services' THEN 'TOS_VIEW'
      WHEN 'Download security suite' THEN 'SECURITY_SUITE_DOWNLOAD'
      WHEN 'View FAQ pages' THEN 'FAQ_VIEW'
      WHEN 'View Contact Us page' THEN 'CONTACT_US_VIEW'
      WHEN 'Access chat' THEN 'CHAT_ACCESS'
      WHEN 'View account history' THEN 'ACCT_HISTORY_VIEW'
      WHEN 'View Site Help system' THEN 'SITE_HELP_VIEW'
      WHEN 'Refer a friend' THEN 'FRIEND_REFER'
      WHEN 'Update payment as credit card' THEN 'CC_PAY_METHOD_SELECT'
      WHEN 'Successful payment' THEN 'PAY_SUCCESS'
      WHEN 'Failed payment' THEN 'PAY_FAILURE'
      WHEN 'Credit score changed' THEN 'CREDIT_SCORE_CHANGE'
      WHEN 'ECP eligible per credit score' THEN 'ECP_ELIGIBLE'
      WHEN 'Email address deleted' THEN 'EMAIL_ADDR_DELETE'
      WHEN 'Phone number changed' THEN 'PHONE_CHANGE'
      WHEN 'Legacy security question assigned' THEN 'LEGACY_SECURITY_QUESTION_ASSIGN'
      WHEN 'SalesOE add services authentication detected' THEN 'SALESOE_ADD_SERVICES_AUTH'
      WHEN 'Prequal through Gmap' THEN 'GMAP_PREQUAL'
      WHEN 'Successful login through store' THEN 'SUCCESSFUL_STORE_LOGIN'
      WHEN 'Username changed' THEN 'USERNAME_CHANGE'
      WHEN 'VLAN Contract Renewal remind me later' THEN 'VLAN_CONTRACT_RENEWAL_REMIND'
      WHEN 'VLAN Contract Renewal accept' THEN 'VLAN_CONTRACT_RENEWAL_ACCEPT'
      WHEN 'VLAN Contract Renewal decline' THEN 'VLAN_CONTRACT_RENEWAL_DECLINE'
      ELSE history_type_name
END;

ALTER IGNORE TABLE CUSTOMER_HISTORY_TYPE
ADD UNIQUE (history_type_name);

# Insert the Default History Type entry in the table for undefined types
INSERT INTO CUSTOMER_HISTORY_TYPE (history_type_display_name,description,visible,history_type_name)
VALUES ('UNDEFINED','DEFAULT HISTORY TYPE NAME',1,'UNDEFINED');

TIA.
V.
0
Nakuru1234
Asked:
Nakuru1234
  • 3
1 Solution
 
awking00Commented:
You're showing MySQL, MS SQL, and Oracle zones. Which rdbms are you actually using?
0
 
Nakuru1234Author Commented:
MYSQL...but your site recommended that if I'm not getting any response...I need to add other zones. I never heard back from anybody at the MYSQL zone?

TIA.
V.
0
 
Nakuru1234Author Commented:
I never got any help?

V.
0
 
Nakuru1234Author Commented:
Close ticket?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now