t is very common to encounter situations where users need to query a database directly. Even though you've created 100 reports in a given application, there will always be the need for that 101st report you didn't
create. Allowing users to write their own reports poses several challenges, however.
For starters, your data model can be quite complicated. How can you simplify your users' view of the data so that they can understand it well enough to obtain the information they need? Additionally, you need to protect users from seeing sensitive information that they are not authorized to see.
In this 10-Minute Solution I will cover some of the basics of views and show you how to use them to solve thee two issues I raised above. My examples are based on the sample pubs database that works with SQL Server 7 and SQL Server 2000.
How do you allow users to query your database directly without confusing them with the data model or compromising sensitive data?
Use views to allow users to access data directly:
- Views allow users to query complex data models easily.
- Views allow you to filter information so that sensitive data remains hidden.