什麼是幸福?

關於部落格
楊康的個性,郭靖的智商...
  • 34886

    累積人氣

  • 0

    今日人氣

    0

    訂閱人氣

SQL查詢某字串在資料之起始位置--PATINDEX

SELECT AMISTXT.MESG_DATA, BRANCH , MFSAPPE.SESSION_NO , MFSAPPE.SEQUENCE_NO,SENDER_SWIFT_ADDR,RECEIV_SWIFT_ADDR FROM MFSAPPE MFSAPPE  JOIN MFSINST MFSINST ON MFSINST.MESG_CREATE_DATE = MFSAPPE.MESG_CREATE_DATE
AND MFSINST.S_UMID = MFSAPPE.S_UMID AND MFSINST.INST_NUM = MFSAPPE.INST_NUM
JOIN MFSTEXT MFSTEXT ON MFSTEXT.MESG_CREATE_DATE = MFSAPPE.MESG_CREATE_DATE
AND MFSTEXT.S_UMID = MFSAPPE.S_UMID JOIN MFSMESG MFSMESG ON MFSMESG.MESG_CREATE_DATE = MFSAPPE.MESG_CREATE_DATE
AND MFSMESG.S_UMID = MFSAPPE.S_UMID JOIN AMISTXT AMISTXT ON AMISTXT.SESSION_NO = MFSAPPE.SESSION_NO
AND AMISTXT.SEQUENCE_NO = MFSAPPE.SEQUENCE_NO
WHERE MFSAPPE.APPE_DATE = ?
AND MFSAPPE.IAPP_NAME = 'SWIFT' AND MFSMESG.SUB_FORMAT = '1' AND MFSMESG.NETW_APPL_IND = 'FIN' AND MFSAPPE.NETW_DELIVERY_STUS <> 5 AND MFSMESG.BRANCH='FMG' AND MFSMESG.MESG_TYPE = '300'
AND ((SUBSTRING(MFSTEXT.DATA_BLOCK,(PATINDEX('%:32B:%',MFSTEXT.DATA_BLOCK)+5),3) = 'USD')
OR (SUBSTRING(MFSTEXT.DATA_BLOCK,(PATINDEX('%:32B:%',MFSTEXT.DATA_BLOCK)+5),3) = 'TWD'))
AND ((SUBSTRING(MFSTEXT.DATA_BLOCK,(PATINDEX('%:33B:%',MFSTEXT.DATA_BLOCK)+5),3) = 'USD') 
OR (SUBSTRING(MFSTEXT.DATA_BLOCK,(PATINDEX('%:33B:%',MFSTEXT.DATA_BLOCK)+5),3) = 'TWD'))
 
PATINDEX目的為找出指定字串之起始位置
用法為PATINDEX('%字串%',欄位名稱)
相簿設定
標籤設定
相簿狀態