Edit field from a date in SQL Developer (DB2)

2

I need to update the value of one field for another from a certain date ( 5/04/2017 ). It is a DB2 type database.

I am using this sentence:

UPDATE tabla SET campo='valor_nuevo'
FROM tabla
WHERE (campo='valor_viejo' AND fecha>=DATE('2017-04-05'));

But I get the following error:

Informe de error:
Error SQL: DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: =;IVIDAD.ACT_GEOGRAFIA;)

Does anyone know how I can fix it?

    
asked by jordisec 27.06.2017 в 09:39
source

1 answer

2

The clause UPDATE has this format:

UPDATE tabla
SET columna1 = valor1, columna2 = valor2, ...
WHERE condición;

With what your query should be something like this:

UPDATE ARIADNA.ARD_RTC_STG_ACTIVIDAD 
SET campo='valor_nuevo' 
WHERE (campo='valor_viejo' AND fecha>=DATE('2017-04-05'));

This assuming that there is only one table involved. If you want to update data from one table with data from another, the thing may be different. If so, edit your question and expand the information.

    
answered by 27.06.2017 / 09:53
source