From what I understand you had something like this:
TabelaX
|--------------------|
| ColA | ColB | ColC |
|------|------|------|
| 1 | 'ab' | 3 |
| 2 | 'ac' | 3 |
| 3 | 'ad' | 5 |
|--------------------|
You have created a new column and the existing values are with NULL
;
TabelaX
|---------------------------|
| ColA | ColB | ColC | ColD |
|------|------|------|------|
| 1 | 'ab' | 3 | null |
| 2 | 'ac' | 3 | null |
| 3 | 'ad' | 5 | null |
|---------------------------|
You want to change to a specific value, just use:
UPDATE TabelaX SET ColD = 1;
If you can’t, it may be that the database server has secure update mode enabled (i.e., you need a clause where
to the update
work), you could use 1=1
that will always be true and will update all records.
UPDATE TabelaX SET ColD = 1 WHERE 1=1;
Upshot:
TabelaX
|---------------------------|
| ColA | ColB | ColC | ColD |
|------|------|------|------|
| 1 | 'ab' | 3 | 1 |
| 2 | 'ac' | 3 | 1 |
| 3 | 'ad' | 5 | 1 |
|---------------------------|
update tabelea set campo = 'outro valor' where campo is null
. Not?– Caffé
'-' oh God........
– Lollipop
@Rafael, it was I who gave the -1 and I explain why: It does not present research effort. If you have something to argue, you are at ease
– CesarMiguel
This is not the place nor the time. However, help more. Don’t just play -1. And if you are so sure of this, why did you withdraw?
– Lollipop