steave - 2 months ago 32

SQL Question

I was updating the values of columns to 0.00 using below query

`update table name set column name = '0.00'`

I did this for many columns but I also accidentally updated one wrong column to 0.00 which I was not suppose to do. now I want the data back for this column, I have backup in Excel file but don't know how to update only this particular column.

Please help

Answer

Depending on the number of rows affected you could try something like putting the following formula in cell `C2`

of your Excel table:

```
="UPDATE tbl_name SET col_name=" & B2 & " WHERE id=" & A2
```

assuming that in your Excel table the `id`

s for each record can be found in column `A`

and the original values in column `B`

. If you then copy the formula down until you have the whole table covered you should end up with a command batch of `UPDATE`

commands which you should **check carefully at first** and then possibly apply on your database to revover the old values.