Tham khảo tài liệu 'programming microsoft sql server 2000 with microsoft visual basic .net - p3', 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ả | DROP VIEW vewEmailContacts GO Create view to select all columns for --all rows from the EmailContacts table. CREATE VIEW vewEmailContacts AS SELECT FROM EmailContacts GO --Select all columns for all rows from --the vewEmailContacts view. SELECT FROM vewEmailContacts Contrasting Unencrypted and Encrypted Views With minor extensions the preceding sample can serve as a template for the creation of any view. The following script illustrates one of these extensions. It creates a view in the Chapter04 database that has the Shippers table in the Northwind database as its base table. While the row source for a view can reside in another database the CREATE VIEW statem ent can create a view only in the current database. Similarly the DROP VIEW statement can remove a view only from the current database. An easy way to reference a row source from another SQL Server database is to use a three-part name. The first part refers to the alternate database name Northwind in this case. The second part designates the owner of the object providing the row source. When the row source owner is the default dbo user you can omit its explicit designation as in the following script . The third name part denotes the name of the database object providing the row source for a view. Figure 4-1 shows the result set from the SELECT statement based on the vewShippers view. Notice that it matches the values in the table which is the source for the vewShippers view. Notice that unlike the first code sample this one doesn t include a specific reference to the Chapter04 database. That s because Query Analyzer will continue to use Chapter04 until you specify a different database with a new USE statement. CreatevewShippers Search for and remove if found the vewShippers view in the Chapter04 database. IF EXISTS SELECT TABLE_NAME FROM WHERE TABLE_NAME vewShippers DROP VIEW vewShippers GO Create a new version of the vewShippers view in the Chapter04 database from