SQL Error in SQL exprsssion using a SUBSTRING

SOLVED

Parents
  • +1
    verified answer

    Use the convention of table.field in place of where you have the field CONTRACT and take out the SELECT & the FROM PMTRAN. It should look like below. However, it be might easier to just to use the field FMTCONTNO, since that is the formatted contract number so it usually has the dashes already in place for most companies.

    SUBSTRING(PMTRAN.CONTRACT,1,3)+'-'+SUBSTRING(PMTRAN.CONTRACT,4,3)+'-'+SUBSTRING(PMTRAN.CONTRACT,7,2)+'-'+SUBSTRING(PMTRAN.CONTRACT,9,3)+'-'+SUBSTRING(PMTRAN.CONTRACT,12,4)

Reply
  • +1
    verified answer

    Use the convention of table.field in place of where you have the field CONTRACT and take out the SELECT & the FROM PMTRAN. It should look like below. However, it be might easier to just to use the field FMTCONTNO, since that is the formatted contract number so it usually has the dashes already in place for most companies.

    SUBSTRING(PMTRAN.CONTRACT,1,3)+'-'+SUBSTRING(PMTRAN.CONTRACT,4,3)+'-'+SUBSTRING(PMTRAN.CONTRACT,7,2)+'-'+SUBSTRING(PMTRAN.CONTRACT,9,3)+'-'+SUBSTRING(PMTRAN.CONTRACT,12,4)

Children