Updating Tables in a SQL
by Dinesh[ Edit ] 2012-08-27 17:28:39
Updating Tables in a SQL
The SQL update command is used to change data in your SQL database.
Syntax:
Start transaction;
Update tablename
set fieldname = value
where fieldname = value;
Rollback work;
Commit work;
Explanation:
01. Issue a Start Transaction command before updating your table. This will allow you to roll back the changes, if necessary. If you do not issue a Start Transaction command, you will not be able the roll back your work.
02. If you find that you have updated a row in error, execute the Rollback Work command.
03. When you are satisfied with your changes, issue the Commit Work command.
04. Use a Where clause to specify which rows will be updated. If you do not include a Where clause, all rows will be updated.
05. Remember to end each command with a semicolon.