ln_conn = SQLCONNECT("DataSource") lc_file = FILETOSTR("sql.txt") lnBatches = OCCURS('GO' + CR ,UPPER(lc_file) )+ 1 FOR lnBatch = 1 TO lnBatches * find the text between the current GOs lnFirstGo = IIF(lnBatch = 1, 1 - LEN('GO' + CR), ; AT('GO' + CR, UPPER(lc_file); , lnBatch - 1)) lnLastGo = IIF(lnBatch = lnBatches, ; LEN(lc_file) + 1, AT('GO' + ; CR, UPPER(lc_file), lnBatch)) lcSQL = SUBSTR(lc_file, ; lnFirstGo + LEN('GO' + CR), lnLastGo - ; lnFirstGo - LEN('GO' + CR)) * run this batch lnResult = SQLExec(ln_conn, lcSQL) IF lnResult <> 1 LOCAL laError[1] AERROR(laError) ** Display Error EXIT ENDIF ENDFORRegards