G
Guest
Hi,
I need to duplicate a record in a table, copying everything but the key. I
used to do this in a different program using a regular SQL sentence (ie
building the sentence in a string and executing it, no parameters) and it
worked fine. However I'm now trying to use a precompiled query such as the
one below (sorry for the Spanish field names) and I get a SQL exception with
the text "Parameter not allowed here". I know "here" means in the SELECT
part, so ... how do I change the key of the new record if I can't put the new
key in a parameter?
INSERT INTO DOCUMENTO_HD (DOCUMENTO_ID, KUNNR, FECHA_ENTREGA, HORA_ENTREGA,
FECHA_COBRO, ESTADO_PC, ESTADO_SAP, TIPO, CONTROL, PRECIO, AGRUPACION) SELECT
?, KUNNR, FECHA_ENTREGA, HORA_ENTREGA, FECHA_COBRO, ESTADO_PC, ESTADO_SAP,
TIPO, CONTROL, PRECIO, AGRUPACION FROM DOCUMENTO_HD WHERE DOCUMENTO_ID=?
I need to duplicate a record in a table, copying everything but the key. I
used to do this in a different program using a regular SQL sentence (ie
building the sentence in a string and executing it, no parameters) and it
worked fine. However I'm now trying to use a precompiled query such as the
one below (sorry for the Spanish field names) and I get a SQL exception with
the text "Parameter not allowed here". I know "here" means in the SELECT
part, so ... how do I change the key of the new record if I can't put the new
key in a parameter?
INSERT INTO DOCUMENTO_HD (DOCUMENTO_ID, KUNNR, FECHA_ENTREGA, HORA_ENTREGA,
FECHA_COBRO, ESTADO_PC, ESTADO_SAP, TIPO, CONTROL, PRECIO, AGRUPACION) SELECT
?, KUNNR, FECHA_ENTREGA, HORA_ENTREGA, FECHA_COBRO, ESTADO_PC, ESTADO_SAP,
TIPO, CONTROL, PRECIO, AGRUPACION FROM DOCUMENTO_HD WHERE DOCUMENTO_ID=?