视图

创建视图:

 1 USE TSQLFundamentals2008;

 2 IF OBJECT_ID('Sales.USACusts') IS NOT NULL

 3   DROP VIEW Sales.USACusts;

 4 GO

 5 CREATE VIEW Sales.USACusts

 6 AS

 7 

 8 SELECT

 9   custid, companyname, contactname, contacttitle, address,

10   city, region, postalcode, country, phone, fax

11 FROM Sales.Customers

12 WHERE country = N'USA';

13 GO

注意,在创建视图的SQL中不能使用ORDER BY子句,除非语句中使用了TOP或FOR XML选项。

你可能感兴趣的:(视图)