Hi Tommycrock,tommycrock wrote:With a bit of help I'd be happy to try modifying this script.tooone7 wrote:Or perhaps show the SQL you use to do the leading zero checking
I found a temporary solution if you're interested.
Get the SQLViewerScript created by Bex.
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