cCSV = 'date_test.csv' cTable = 'date_test' cDateSeparator = '/' set procedure to :duflp:stringex.cc q = new query() q.sql = 'select * from '+cTable q.active = true f = new file() f.open(cCSV) do while not f.eof() cRead = f.gets(100000) aArray = new stringex(cRead).breakstring(",", true) q.rowset.beginAppend() for n = 1 to q.rowset.fields.size if q.rowset.fields[n].type = 'DATE' q.rowset.fields[n].value = create_date(aArray[n]) else q.rowset.fields[n].value = aArray[n] endif next q.rowset.save() enddo f.close() q.active = false function create_date(cDate) c1 = substr(cDate,1,at(cDateSeparator,cDate)-1) c2= substr(cDate,at(cDateSeparator,cdate,1)+1,at(cDateSeparator,cDate,2)-at(cDateSeparator,cDate,1)-1) c3= substr(cDate,at(cDateSeparator,cdate,2)+1) //The following is based on the date in the CSV file being yyyy/mm/dd yy = c1 mm = c2 dd = c3 //If the date format in the CSV is dd/mm/yyyy use the following // yy = c3 // mm = c2 // dd = c3 //If the date format in the CSV is mm/dd/yyyy use the following // yy = c3 // mm = c1 // dd = c2 dDate = new date(val(yy),val(mm)-1,val(dd)) return dDate