Hello;
A friend gave me this syntax and they are unavailable at the moment and I need this asap. I am trying to figure out how SQL figures this out. Below the syntax takes a field in a file and breaks apart the pieces of the key for other uses. The field looks like this 1234567*AWD*07F A (or 1234567*FPER*07 FA). I just need to understand how the numbers behind the TA_2007_ID field work to break apart they key?? The first one is easy.. it just gets the first 7 numbers. The first part is the only one where it is consistantly 7 numbers.. the others vary depending on the award.
Thanks in advance...
SELECT a.* ,substr(a.TA_20 07_ID, 1,7) as student_id
,substr(a.TA_20 07_ID,INSTR(a.T A_2007_ID,'*', 1, 1)+1,INSTR(a.TA _2007_ID,'*',1, 2)-INSTR(a.TA_2007 _ID,'*', 1, 1)-1) as award_only
,substr(a.TA_20 07_ID,INSTR(a.T A_2007_ID,'*', 1, 2)+1,INSTR(a.TA _2007_ID,'*',1, 2)-INSTR(a.TA_2007 _ID,'*', 1, 1)+4) as term_only
FROM COLL_PRODUCTION .TA_2007 A
A friend gave me this syntax and they are unavailable at the moment and I need this asap. I am trying to figure out how SQL figures this out. Below the syntax takes a field in a file and breaks apart the pieces of the key for other uses. The field looks like this 1234567*AWD*07F A (or 1234567*FPER*07 FA). I just need to understand how the numbers behind the TA_2007_ID field work to break apart they key?? The first one is easy.. it just gets the first 7 numbers. The first part is the only one where it is consistantly 7 numbers.. the others vary depending on the award.
Thanks in advance...
SELECT a.* ,substr(a.TA_20 07_ID, 1,7) as student_id
,substr(a.TA_20 07_ID,INSTR(a.T A_2007_ID,'*', 1, 1)+1,INSTR(a.TA _2007_ID,'*',1, 2)-INSTR(a.TA_2007 _ID,'*', 1, 1)-1) as award_only
,substr(a.TA_20 07_ID,INSTR(a.T A_2007_ID,'*', 1, 2)+1,INSTR(a.TA _2007_ID,'*',1, 2)-INSTR(a.TA_2007 _ID,'*', 1, 1)+4) as term_only
FROM COLL_PRODUCTION .TA_2007 A
Comment