Home > Database > Mysql Tutorial > SQL Server中创建视图索引

SQL Server中创建视图索引

WBOY
Release: 2016-06-07 14:55:07
Original
1527 people have browsed it

你正在使用一个 SQL Server 2005 数据库,它包含一个名为 Customers 的表。其中 Customers 表包含如下的列定义: Create Table Customers ( CustomerID Int , CompanyName Varchar(50) , FirstName Varchar(20) , LastName Varchar(20) , Picture Varbinary(max

你正在使用一个 SQL Server 2005 数据库,它包含一个名为 Customers 的表。其中 Customers 表包含如下的列定义:
             
Create Table Customers
(
CustomerID Int ,
CompanyName Varchar(50) ,
FirstName Varchar(20) ,
LastName Varchar(20) ,
Picture Varbinary(max) ,
Address1 Varchar(30) ,
Address2 Varchar(30) ,
City Varchar(30) ,
StateProvince Char(2) ,
PostalCode Varchar(10) ,
CountryCode Char(2)
)
 
你使用以下 Transact-SQL 语句创建一个名为 v_Customer 的视图。
CREATE VIEW v_Customer AS 
SELECT  CustomerID, CompanyName, FirstName, LastName, Picture  
FROM  Customers。
你想要在 v_ Customer 视图中创建一索引。在创建索引前,还需要修改此 Transact-SQL 语句。
应采取举措?
--表名包含模式名。 
--包含 WITH  SCHEMABINDING 语句 

CREATE VIEW dbo.v_Customer WITH SCHEMABINDING AS  
SELECT  CustomerID, CompanyName, FirstName, LastName, Picture   
FROM  dbo.Customers
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template