Creating INFORMATION_SCHEMA Views
You may be aware that you can query ANSI-style INFORMATION_SCHEMA views from any database even though they actually reside only in master. The ability to create a view in the master database and to be able to query it in the context of the current database can come in quite handy. Imagine all the object duplication you could avoid if you could create views that behaved like system procedures—that ran in the context of the current database even though they resided in master. As with most things SQL Server, if the system can create an object with special properties, so can you. The trick is in finding out how given that the precise technique usually undocumented. This is certainly the case with INFORMATION_SCHEMA ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access