数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

SQL Server 2000的视图中必须小心使用*符号[1]


发布日期:2024年06月03日
 
SQL Server 2000的视图中必须小心使用*符号[1]

有些朋友看到这个标题可能会有疑问难道在视图中使用*符号还有何要注意的地方吗?对于这个问题我们先不必回答先看一下例子吧

我这里使用的数据库是SqlServer自带的Northwind这样方便大家自己私下里测试首先创建两个视图视图的脚本如下

视图 vCustomersA

create view vCustomersA

as

select CustomerID CompanyNameContactNameContactTitle

AddressCityRegionPostalCodeCountryPhoneFax

from dboCustomers

go

视图 vCustomersB

create view vCustomersB

as

select * from vCustomersA

go

然后使用这两个视图查询客户ID为ALFKI的资料查询语句如下

select * from vCustomersA where CustomerID = ALFKI

select * from vCustomersB where CustomerID = ALFKI

[] [] [] [] []

               

上一篇:SQL Server 2000的视图中必须小心使用*符号[2]

下一篇:SQL Server 2000的视图中必须小心使用*符号[5]