Update Example - SQL Update.



Free Tips, Tutorials, and Examples














Submit Your Own Tip     View All Tips!

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 tips and tricks. Although it is mostly computer and tech related tips, there are also tips and tricks related to various other helpful topics like how much things cost or how much you paid. If you have an important tip that you think should be listed, feel free to post it below. Please make it detailed, as the biggest mistake people make is not explaining well enough or including enough details. I review all posts and try to correct spelling errors and remove spam.

Submit Tip or Ask Question:

Post It Here (Explain in detail)

View Other Databases:

View All Tips and Tricks
Spyware and System Task Database