Beginning Microsoft SQL Server 2008 Programming by Robert Vieira

Beginning Microsoft SQL Server 2008 Programming by Robert Vieira

Author:Robert Vieira
Language: eng
Format: epub, pdf
Publisher: Wiley Publishing, Inc.
Published: 2011-01-20T16:00:00+00:00


Summary

Views tend to be either the most over- or most under-used tools in most of the databases I’ve seen. Some people like to use them to abstract seemingly everything (often forgetting that they are adding another layer to the process when they do this). Others just seem to forget that views are even an option. Personally, like most things, I think you should use a view when it’s the right tool to use — not before, not after. Things to remember with views include:

Stay away from building views based on views — instead, adapt the appropriate query information from the first view into your new view.

Remember that a view using the WITH CHECK OPTION provides some flexibility that can’t be duplicated with a normal CHECK constraint.

Encrypt views when you don’t want others to be able to see your source code — either for commercial products or general security reasons, but also remember to keep a copy of your unencrypted code; it can’t be retrieved after you’ve encrypted it.

Using an ALTER VIEW completely replaces the existing view other than permissions. This means you must include the WITH ENCRYPTION and WITH CHECK OPTION clauses in the ALTER statement if you want encryption and restrictions to be in effect in the altered view.

Use sp_helptext to display the supporting code for a view — avoid using the system tables.

Minimize the user of views for production queries — they add additional overhead and hurt performance.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.