are these codes fixed length?
ie always 9 characters?
what you could do is write a series of queries that progressively chop out blocks of 9
eg:-
'extract first code
Code:
INSERT INTO Codes ( Code, NoCodes )
SELECT mid(Code,1,9) AS NewCode, 1 AS NewCodeLength
FROM codes
WHERE len(codes.[NoCodes])>9);
'then modify that for each remaining block
'extract code 2
Code:
INSERT INTO Codes ( Code, NoCodes )
SELECT mid(Code,11,9) AS NewCode, 1 AS NewCodeLength
FROM codes
WHERE len(codes.[NoCodes])>=19);
'extract code 3
Code:
INSERT INTO Codes ( Code, NoCodes )
SELECT mid(Code,21,9) AS NewCode, 1 AS NewCodeLength
FROM codes
WHERE len(codes.[NoCodes])>=29);
'and so on
you'd need to change the start point for the mid fucntion from 1,11,21 to alwasy be the start of the next code block eg 31, 41, 51, 61
you'd need to change the where statement to reflect the length of the record that may have a value in (as your codes are 9 characters long then its on 9 or greater boundariews ie 9,19,29,39 and so on
but that will work ONLY if your codes are 9 character with one space, if they are floating format then you are going to have to do some other method.
if you had some records with more than one space between them then you'd need to pre process the codes to standardise at 10 character intervals
if this is a regualr process then you coudl create a macro which ran a block of queries in succession