You probably need to specify which rows you want to update...
UPDATE
mytable
SET
column1 = value1,
column2 = value2
WHERE
key_value = some_value;
My answer is repeating what others have said before, but I thought I'd add an example, using MySQL
, only because the previous answers were a little bit cryptic to me.
The general form of the command you need to use to update a single row's column:
UPDATE my_table SET my_column='new value' WHERE something='some value';
And here's an example.
BEFORE
mysql> select aet,port from ae;
+------------+-------+
| aet | port |
+------------+-------+
| DCM4CHEE01 | 11112 |
| CDRECORD | 10104 |
+------------+-------+
2 rows in set (0.00 sec)
MAKING THE CHANGE
mysql> update ae set port='10105' where aet='CDRECORD';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
AFTER
mysql> select aet,port from ae;
+------------+-------+
| aet | port |
+------------+-------+
| DCM4CHEE01 | 11112 |
| CDRECORD | 10105 |
+------------+-------+
2 rows in set (0.00 sec)
UPDATE
will change only the columns you specifically list.
UPDATE some_table
SET field1='Value 1'
WHERE primary_key = 7;
The WHERE
clause limits which rows are updated. Generally you'd use this to identify your table's primary key (or ID) value, so that you're updating only one row.
The SET
clause tells MySQL which columns to update. You can list as many or as few columns as you'd like. Any that you do not list will not get updated.
UPDATE
only changes the values you specify:
UPDATE table SET cell='new_value' WHERE whatever='somevalue'
Try the following:
UPDATE TableName SET ValueName=@parameterName WHERE
IdName=@ParameterIdName
UPDATE TABLE <tablename>
SET <COLUMN=VALUE>
WHERE <CONDITION>
Example:
UPDATE TABLE teacher SET teacher_name='NSP' WHERE teacher_id='1'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With