428 Part I EXAM PREPARATION continued Creating Partitioned
428 Part I EXAM PREPARATION continued Creating Partitioned Views After reviewing all the guidelines for creating partitioned views, you are ready to implement them in SQL Server. When creating partitioned views, as noted earlier, the first step is cutting the table into horizontal sections, each section being called a member table and having the same number of columns and same attributes as the original table. To create a partitioned view, follow Step by Step 7.8. STEP BY STEP 7.8 Creating a Partitioned View 1. Initiate the SQL Query Analyzer by selecting Query Analyzer from the Start menu. NOTE Using WHERE with Your Partitioned View When you query a distributed partitioned view based on the partitioning criteria in the WHERE clause, you are querying against only the servers that fall within the scope of the WHERE clause. This yields a performance increase for you because of the way the distributed partitioned view uses the mandatory CHECK constraint. You receive the same advantage if you use CHECK constraints on local partitioned views. 2. You need the member tables to exist before you can gather the partitioned data. For this example, you will create three member tables to hold products for a multi-national food company. This company makes products to be sold in several different countries, and the products have been separated into tables related to their regions or countries. The following code creates the three tables: CREATE TABLE Product1 ( Product_ID INT PRIMARY KEY CHECK (Product_ID .BETWEEN 1 and 50), Product CHAR(30) ) CREATE TABLE Product2 ( Product_ID INT PRIMARY KEY CHECK (Product_ID .BETWEEN 51 and 100), Product CHAR(30) ) CREATE TABLE Product3 ( Product_ID INT PRIMARY KEY CHECK (Product_ID .BETWEEN 101 and 150), Product CHAR(30) ) 3. These tables have to have some data before you can combine them into a view. INSERT two records for each as follows and as shown in Figure 7.16. INSERT Product1
For high quality website hosting services please check tomcat web hosting website.