Changing existing data  Using the set clause with update

Chapter 7: Adding, Changing, and Deleting Data

update syntax

A simplified version of the update syntax for updating specified rows with an expression is:

update table_name 
     set column_name = expression 
     where search_conditions

For example, if Reginald Blotchet-Halls decides to change his name, here is how to change his row in the authors table:

update authors 
set au_lname = "Health", au_fname = "Goodbody" 
where au_lname = "Blotchet-Halls"

This statement updates a table based on data from another table:

update table_name 
     set column_name = expression 
          from table_name 
          where search_conditions 

You can set variables in an update statement with:

update table_name 
     set variable_name = expression 
          where search_conditions 

The full syntax for update is in the Reference Manual.





Copyright © 2005. Sybase Inc. All rights reserved. Using the set clause with update

View this book as PDF