Update Example - SQL Update.



Free Tips, Tutorials, and Examples














Submit Your Own Tip     View All Tips!

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 a tip that you think should be listed, feel free to post it below. Please make it detailed as I review all posts and try to cleanup spelling errors and remove spam.

Submit Your Own Tip? Ask Questions?:

Post It Here (Please explain in detail)

Other Topics:

View other tips
View whats running in your tasklist