Tham khảo tài liệu 'programming microsoft sql server 2000 with microsoft visual basic .net - p2', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | information about views as well as tables. Specify a TABLE_TYPE column value of VIEW in the WHERE clause for a SELECT statement to return only views. With the COLUMNS view of the INFORMATION_SCHEMA you can return information about columns in a database. The third batch illustrates this application. It also reveals a new syntax for specifying the database serving as the source for the view. Notice that the specification of the view name has three parts. The first of these is the database name Chapter02. Designating a database name as the first part removes the need to designate a database context with a USE statement. This is because no matter what database context the statement executes it always extracts information from the database that is the first part of the INFORMATION_SCHEMA view name. The second and third parts follow the convention for the preceding batches except for the name of the specific INFORMATION_SCHEMA view COLUMNS . The sample also includes a WHERE clause to reference a particular table in particu lar EmailContacts. Without the WHERE clause the T-SQL statement in the batch will return information for all the columns within the Chapter02 database including those from system and user-defined tables. The final batch shows the I NFORMATI ON_SCHEMA syntax for reporting about the keys in a database. These include the primary keys foreign keys and unique keys. The information is really about the columns on which an application defines its keys. As with the preceding batch this sample restricts the result only to keys for the EmailContacts table. INFORMATION_SCHEMA_Samples List databases on current server. USE master SELECT FROM GO List user-defined tables in Chapter02 database. USE Chapter02 SELECT FROM WHERE NOT SUBSTRING TABLE_NAME 1 3 sys OR SUBSTRING TABLE_NAME 1 3 dtp GO List all columns in EmailContacts table. SELECT FROM WHERE TABLE_NAME EmailContacts GO .