Solved

SQL query script performance 3

Posted on 2008-10-30
4
256 Views
Last Modified: 2012-05-05
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
Comment
Question by:Nakuru1234
  • 3
4 Comments
 
LVL 32

Expert Comment

by:awking00
ID: 22857627
You're showing MySQL, MS SQL, and Oracle zones. Which rdbms are you actually using?
0
 

Accepted Solution

by:
Nakuru1234 earned 0 total points
ID: 22866845
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
 

Author Comment

by:Nakuru1234
ID: 22931175
I never got any help?

V.
0
 

Author Comment

by:Nakuru1234
ID: 22931190
Close ticket?
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now