I am managing some dynamic Web content using ASP, SQL and Microsoft Access. I want to add a date stamp in dynamic pages to give the user information about the last update. I want the date stamp to come from the properties of the Microsoft Access table, not from the last modification done to the ASP page. Can you help me with this?
Using a database behind a dynamic Web site is very common today. Typically, each dynamic entry -- whether it's a full Web page, or just a portion of one -- is stored as a row in a "contents" table.
To give each entry its own "last updated" date, add a DATETIME column to the table, with a column name like UPDATED. Each row will have the date and time of the last update to that row's data. The ASP page that maintains the contents table will reset the value in the UPDATED column whenever it updates a row. If you have a separate ADDED column to distinguish between date added and date last updated, then you can set UPDATED null when a row is added. Many people use just the one field for both purposes.
If you need the last update overall in the whole site (e.g. "This site last updated xx/xx/xxxx" on the home page), then just use
select max(updated) from yourtable
Do not use an automatic TIMESTAMP datatype (one that is updated automatically by the database when any change is made to the row) for the UPDATED column. While this would save you the trouble of updating this column in your ASP page, there are situations where you will not want to reset the date last updated. Minor corrections, such as inserting the ® character after a registered name, are not really updates to content. It would be misleading to display a new date in these cases.
For More Information
- Dozens more answers to tough SQL questions from Rudy Limeback.
- The Best SQL Web Links: tips, tutorials, scripts, and more.
- Have an SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
Dig Deeper on Oracle and SQL
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.