I introduce this whole concept in Applied SQL: You Have Homework. Find all assignments on the Applied SQL page.
Prerequisites: basic T-SQL (including JOINs and LIKE), ability to search BOL
Reading: SQL Server Books Online sys.objects article.
Level 1 Assignments: Using sys.objects, write a query for each of the following:
- Get a list of all views.
- Get a list of all tables with the word “product” in the name.
Level 2 Assignment: Using sys.objects, write a query for each of the following:
- Get a list of all tables and their schema names. (You will need to join to another system table; lose points for using SCHEMA_NAME.)
- Get a list of any tables and column name, where the column name contains the word “address”. (You will need to join to yet another system table.)
Bonus points: Post your scripts (or a link to them) in the comments below, just to show off that you did it.
Happy learning,
Jen McCown
www.MidnightDBA.com/Jen