Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i'm trying to use a FOR EACH statement in a load script but the scrip fails. Any ideas what's wrong?
FOR EACH region in 'A','B','D','E','F','G','H','J','K'
OLATPOSTCODE:
Load @1 as Seven_digit_Postcode,
@2 as Eight_digit_PostCode,
trim(replace(@2,' ' , '')) as Short_Postcode,
@4 as Term_Date,
@5 as County_Code,
@6 as LA_Code,
@7 as Ward_Code,
@9 as OS_Lat,
@10 as OS_Long,
@12 as SHA,
@14 as Country,
@17 as Region_Code
FROM
(txt, codepage is 1252, no labels, delimiter is ',', msq)
WHERE @4 = '' and @17 = 'region';
Store OLATPOSTCODE into 'C:\Userwork\OLAT\May 2010 Development\Postcode QVDs\OLATPOSTCODE' & '$(region)';
drop table OLATPOSTCODE;
NEXT
Thanks.
Which error?
The path
C:\Userwork\OLAT\May 2010 Development\Postcode data\Copy of OMSAS CD (to be left unchanged, so that information is backup up)\Data\NSPDF_MAY_2007_EN_100M\NSPDF_MAY_2007_EN_100M.csv]
is rather, well, unconventional. Have you tried with a more simple path?
Rgds,
Joachim
It is unconventional but worked fine without the FOR EACH loop. It isn't error message - the script hangs and then the pop up appears saying that the load has failed.
Thanks again
May be the file name in the store command is the reason for this error message.
Try
Store OLATPOSTCODE into 'C:\Userwork\OLAT\May 2010 Development\Postcode QVDs\OLATPOSTCODE$(region)';
instead of
Store OLATPOSTCODE into 'C:\Userwork\OLAT\May 2010 Development\Postcode QVDs\OLATPOSTCODE' & '$(region)';