Update Example - SQL Update.



Free Tips, Tutorials, and Examples

Main Page    Submit Question or Tip     View List

Detailed Description:

The following is a DB2 SQL update example. This is an example of how to update a timestamp column and set it equal to the current timestamp. The table is named "YOURTABLE", where it can have many columns, although we only update 1 in this example. You can update more then 1 of course.

Although this sample is a mainframe DB2 SQL example, it really doesn't matter where you are running as this is pretty much the same everywhere when using SQL. This will set the field named col_tms on all rows in the table equal to the current timestamp if the key_field has a 10 for its value. All other rows remain untouched.

Update YOURTABLE set col_tms = current timestamp where key_field = 10


This site provides a list of interesting subjects, tips, and tricks. Although it is mostly computer tips, there are also tips and tricks related to various other helpful topics besides just computers. If you have an important tip that you think should be listed, feel free to post it below. Although I still take tips via email, I often scan and review posts on the page below and prefer that method.

Submit Tip or Ask Question:

Post It Here

View Other Databases:

View All Tips and Tricks
Spyware and System Task Database