I have just asked a question on SuperUser regarding Microsoft Excel. Thankfully someone answered – but then I realised that if I alter the SKU column and re-import the product CSV file it won’t update the products. It would treat them as new products because the SKU codes don’t match.
The question was:
I am trying to edit product codes in Excel so that each product code is exactly 8 digits in length.
Currently the product codes are different lengths, for example:
12
1222
213212
32
3231
3213131
The above codes should read as follows:
00000012
00001222
00213212
00000032
00003231
03213131
As you can see all product codes are now 8 digits in length, any product codes that were less than 8 have had the correct number of 0’s prepended to them.
It’s surprisingly easy in Excel- but is it possible to do it directly on the database tables?
If you’re using MS SQL Server:
You just fill in a bunch of 0’s at the start and then take the 8 right-most characters.