视图

一:简单的视图

use xland
go
create view my_vw
as
   
select a.id, a.title,u.username from mytable a join  [user] u on u.id = a.uid
执行这个视图
use xland
go
select * from my_vw
结果跟直接运行
select a.id, a.title,u.username from mytable a join  [user] u on u.id = a.uid
是一样的

二:删除和修改视图
alter view  yourviewname   as...
drop view  yourviewname   as...
三:加密视图
alter  view  yourviewname  with encryption as...
加密了之后连你自己也看不到原代码了
原文地址:https://www.cnblogs.com/liulun/p/1373449.html