Domanda

I work on a CFML script to backup some data in a CSV file from Informix database. The problem is the table has many records 286906 and my scripts timeouts (even I set it not to), the best I could successfully was 260000 with:

SELECT FIRST 260000
  APE1, APE2, CALLE, CODPOSTAL, DNI, FCADU, FENACI, LOCALIDAD, NOMBRE, NSS, PROV, TELEFONO
FROM
  mytable WHERE FCADU IS NOT NULL AND FENACI IS NOT NULL

is there any way to select the rest of 260000 and then the rest? I tried with:

SELECT SKIP 260000 FIRST 520000
  APE1, APE2, CALLE, CODPOSTAL, DNI, FCADU, FENACI, LOCALIDAD, NOMBRE, NSS, PROV, TELEFONO
FROM
  mytable WHERE FCADU IS NOT NULL AND FENACI IS NOT NULL

but I get Error Executing Database Query. A syntax error has occurred.

È stato utile?

Soluzione

You can use the Unload statement for creating a file from database:

UNLOAD TO 'mytable.txt' SELECT * FROM mytable;

Maybe that this not works in CFML environment. So you can create a stored procedure which unloads your data.

See unload statement in stored procedure

Altri suggerimenti

Is it your script timing out or your database connection? From your question it sou ds to me like its not the coldfusion template that is timing out but the cfquery connection to the database. There is a timeout attribute for the cfquery tag. However apparently it is not reliable a better option is to configure the timout in the advanced section of the datasource within the coldfusion administrator.

Charlie Arehart blogged about this feature here: http://www.carehart.org/blog/client/index.cfm/2010/7/14/hidden_gem_in_cf9_admin_querytimeout

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top