Take away leading zero in dates

From TNG_Wiki
Jump to navigation Jump to search

The following query takes away leading zeros


Copy and paste the text between the lines into the MySQL section of your MySQL admin, IMPORTANT: Make a backup before you try anything and use this at your own risk!


UPDATE tng_families SET marrdate = REPLACE(marrdate,'01 ','1 ');
UPDATE tng_families SET divdate = REPLACE(divdate,'01 ','1 ');
UPDATE tng_people SET birthdate = REPLACE(birthdate,'01 ','1 ');
UPDATE tng_people SET altbirthdate = REPLACE(altbirthdate,'01 ','1 ');
UPDATE tng_people SET deathdate = REPLACE(deathdate,'01 ','1 ');
UPDATE tng_people SET burialdate = REPLACE(burialdate,'01 ','1 ');
UPDATE tng_events SET eventdate = REPLACE(eventdate,'01 ','1 ');

UPDATE tng_families SET marrdate = REPLACE(marrdate,'02 ','2 ');
UPDATE tng_families SET divdate = REPLACE(divdate,'02 ','2 ');
UPDATE tng_people SET birthdate = REPLACE(birthdate,'02 ','2 ');
UPDATE tng_people SET altbirthdate = REPLACE(altbirthdate,'02 ','2 ');
UPDATE tng_people SET deathdate = REPLACE(deathdate,'02 ','2 ');
UPDATE tng_people SET burialdate = REPLACE(burialdate,'02 ','2 ');
UPDATE tng_events SET eventdate = REPLACE(eventdate,'02 ','2 ');

UPDATE tng_families SET marrdate = REPLACE(marrdate,'03 ','3 ');
UPDATE tng_families SET divdate = REPLACE(divdate,'03 ','3 ');
UPDATE tng_people SET birthdate = REPLACE(birthdate,'03 ','3 ');
UPDATE tng_people SET altbirthdate = REPLACE(altbirthdate,'03 ','3 ');
UPDATE tng_people SET deathdate = REPLACE(deathdate,'03 ','3 ');
UPDATE tng_people SET burialdate = REPLACE(burialdate,'03 ','3 ');
UPDATE tng_events SET eventdate = REPLACE(eventdate,'03 ','3 ');
UPDATE tng_families SET marrdate = REPLACE(marrdate,'04 ','4 ');
UPDATE tng_families SET divdate = REPLACE(divdate,'04 ','4 ');
UPDATE tng_people SET birthdate = REPLACE(birthdate,'04 ','4 ');
UPDATE tng_people SET altbirthdate = REPLACE(altbirthdate,'04 ','4 ');
UPDATE tng_people SET deathdate = REPLACE(deathdate,'04 ','4 ');
UPDATE tng_people SET burialdate = REPLACE(burialdate,'04 ','4 ');
UPDATE tng_events SET eventdate = REPLACE(eventdate,'04 ','4 ');
UPDATE tng_families SET marrdate = REPLACE(marrdate,'05 ','5 ');
UPDATE tng_families SET divdate = REPLACE(divdate,'05 ','5 ');
UPDATE tng_people SET birthdate = REPLACE(birthdate,'05 ','5 ');
UPDATE tng_people SET altbirthdate = REPLACE(altbirthdate,'05 ','5 ');
UPDATE tng_people SET deathdate = REPLACE(deathdate,'05 ','5 ');
UPDATE tng_people SET burialdate = REPLACE(burialdate,'05 ','5 ');
UPDATE tng_events SET eventdate = REPLACE(eventdate,'05 ','5 ');
UPDATE tng_families SET marrdate = REPLACE(marrdate,'06 ','6 ');
UPDATE tng_families SET divdate = REPLACE(divdate,'06 ','6 ');
UPDATE tng_people SET birthdate = REPLACE(birthdate,'06 ','6 ');
UPDATE tng_people SET altbirthdate = REPLACE(altbirthdate,'06 ','6 ');
UPDATE tng_people SET deathdate = REPLACE(deathdate,'06 ','6 ');
UPDATE tng_people SET burialdate = REPLACE(burialdate,'06 ','6 ');
UPDATE tng_events SET eventdate = REPLACE(eventdate,'06 ','6 ');
UPDATE tng_families SET marrdate = REPLACE(marrdate,'07 ','7 ');
UPDATE tng_families SET divdate = REPLACE(divdate,'07 ','7 ');
UPDATE tng_people SET birthdate = REPLACE(birthdate,'07 ','7 ');
UPDATE tng_people SET altbirthdate = REPLACE(altbirthdate,'07 ','7 ');
UPDATE tng_people SET deathdate = REPLACE(deathdate,'07 ','7 ');
UPDATE tng_people SET burialdate = REPLACE(burialdate,'07 ','7 ');
UPDATE tng_events SET eventdate = REPLACE(eventdate,'07 ','7 ');
UPDATE tng_families SET marrdate = REPLACE(marrdate,'08 ','8 ');
UPDATE tng_families SET divdate = REPLACE(divdate,'08 ','8 ');
UPDATE tng_people SET birthdate = REPLACE(birthdate,'08 ','8 ');
UPDATE tng_people SET altbirthdate = REPLACE(altbirthdate,'08 ','8 ');
UPDATE tng_people SET deathdate = REPLACE(deathdate,'08 ','8 ');
UPDATE tng_people SET burialdate = REPLACE(burialdate,'08 ','8 ');
UPDATE tng_events SET eventdate = REPLACE(eventdate,'08 ','8 ');
UPDATE tng_families SET marrdate = REPLACE(marrdate,'09 ','9 ');
UPDATE tng_families SET divdate = REPLACE(divdate,'09 ','9 ');
UPDATE tng_people SET birthdate = REPLACE(birthdate,'09 ','9 ');
UPDATE tng_people SET altbirthdate = REPLACE(altbirthdate,'09 ','9 ');
UPDATE tng_people SET deathdate = REPLACE(deathdate,'09 ','9 ');
UPDATE tng_people SET burialdate = REPLACE(burialdate,'09 ','9 ');
UPDATE tng_events SET eventdate = REPLACE(eventdate,'09 ','9 ');