Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a load script where I use the same value in multiple places. It is a date in the format YYYYMM so 201408 in the example below.
LOAD text(City) as City,
text(State) as State
FROM
(txt, codepage is 1252, embedded labels, delimiter is '\t');
What I want to do is to declare a variable called monthDate that is equal to 201408. Then I want to use that variable in place of 201408 throughout my load script. This way I only have to change the date in one place than in many. Is it possible to do this? Ideally it would something like this.
monthDate = 201408
LOAD text(City) as City,
text(State) as State
FROM
(txt, codepage is 1252, embedded labels, delimiter is '\t');
SET monthDate = 201408;
LOAD text(City) as City,
text(State) as State
FROM
(txt, codepage is 1252, embedded labels, delimiter is '\t');
SET monthDate = 201408;
LOAD text(City) as City,
text(State) as State
FROM
(txt, codepage is 1252, embedded labels, delimiter is '\t');
Create monthDate as a variable using SET. Then reference it in your script as $(monthDate).
-Rob
SET monthDate = 201408;
LOAD text(City) as City,
text(State) as State
FROM
(txt, codepage is 1252, embedded labels, delimiter is '\t');
Thanks! I knew there had to be a way, but was unsure of the syntax.