Go to Tools->Scripts->SqlViewer
Then you can paste the following SQL Query in the textfield and click the "Execute DDL/DML Statement" button.

Here's the SQL for changing the SeasonNumber:
UPDATE Songs SET SeasonNumber = "0"||SeasonNumber WHERE (SeasonNumber != "" AND SeasonNumber NOT LIKE "0%" AND SeasonNumber < 10);

And for the EpisodeNumber:
UPDATE Songs SET EpisodeNumber = "0"||EpisodeNumber WHERE (EpisodeNumber != "" AND EpisodeNumber NOT LIKE "0%" AND EpisodeNumber < 10);

It worked for updating my Episode numbers (a few were skipped) but it moslty failed when running it on the Season numbers. I guess it is because it is not a number field but a text field so you cannot check for something "less than 10" (< 10).

I guess you can run the following query:
UPDATE Songs SET EpisodeNumber = "01" WHERE EpisodeNumber = "1";

and repeat that 9 times, each time incrementing the number. So "01" becomes "02" and = "1" becomes "2".

I think I'm going to do that now, it's faster than selecting everythin in the viewer and updating it.

Please make a backup of your database first!
Here's a nice script by Trixmoto: Backup

tommycrock wrote:Thanks for that, although looking at it it's to add a leading zero, I'm wanting to delete them. Got any SQL for that?

Sorry to get back only now.

I have a solution for you! To remove the leading zero you can use the following SQL for SeasonNumber:
UPDATE Songs SET SeasonNumber = replace(SeasonNumber, 0, "") WHERE SeasonNumber = "01" OR SeasonNumber = "02" OR SeasonNumber = "03" OR SeasonNumber = "04" OR SeasonNumber = "05" OR SeasonNumber = "06" OR SeasonNumber = "07" OR SeasonNumber = "08" OR SeasonNumber = "09";

Vyper wrote:The options for this script allows you to remove the leading zero instead of adding it. Will that do what you want?

I don't have MM4 installed yet so I don't have a way of checking it myself.

Hi Vyper the problem is that me and Tommy want this script to also add/remove leading zeros on Episode and Season numbers for our series and the current version of the script does not yet cater for that.