Manage Learn to apply best practices and optimize your operations.

Limit access to data by time

USe a view to to see data during a specific time of day.

Recently we received an inquiry from our users asking if there was a way to grant access to a table for a specific period of time. They only wanted their users to see data during a specific time of day. While a grant won't provide the solution, a view will. We created the view using DDL similar to the following. Their users were then granted access to the view. A simple solution to a rather odd request. It has been tested on DB2 UDB v7 on z/OS.

 CREATE VIEW      TIME_EMP                    
(EMP_NBR , EMP_NM , DEPT_NBR , JOB_CD )              
 AS SELECT EMP_NBR , EMP_NM , DEPT_NBR , JOB_CD      
 FROM EMP                                    
 WHERE CURRENT TIME BETWEEN '11.00.00' AND '11.35.00'

For More Information

  • Feedback: E-mail the editor with your thoughts about this tip.
  • More tips: Hundreds of free DB2 tips and scripts.
  • Tip contest: Have a DB2 tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize -- submit your tip today!
  • Ask the Experts: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.
  • Forums: Ask your technical DB2 questions--or help out your peers by answering them--in our active forums.
  • Best Web Links: DB2 tips, tutorials, and scripts from around the Web.

Dig Deeper on Data backup, storage and retrieval on iSeries

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close