下例创建称为 All_authors 的视图,该视图包含全部的作者。权限授予了视图,但需求改为从犹他州选择作者。于是,使用 ALTER VIEW 替换了该视图。-- Create a view from the authors table that contains all authors.CREATE VIEW All_authors (au_fname, au_lname, address, city, zip)
AS
SELECT au_fname, au_lname, address, city, zip
FROM pubs..authors
GO
-- Grant SELECT permissions on the view to public.
GRANT SELECT ON All_authors TO public
GO-- The view needs to be changed to include all authors
-- from Utah.
-- If ALTER VIEW is not used but instead the view is dropped and
-- re-created, the above GRANT statement and any other statements
-- dealing with permissions that pertain to this view
-- must be re-entered.ALTER VIEW All_authors (au_fname, au_lname, address, city, zip)
AS
SELECT au_fname, au_lname, address, city, zip
FROM pubs..authors
WHERE state = 'UT'
GO
AS
SELECT au_fname, au_lname, address, city, zip
FROM pubs..authors
GO
-- Grant SELECT permissions on the view to public.
GRANT SELECT ON All_authors TO public
GO-- The view needs to be changed to include all authors
-- from Utah.
-- If ALTER VIEW is not used but instead the view is dropped and
-- re-created, the above GRANT statement and any other statements
-- dealing with permissions that pertain to this view
-- must be re-entered.ALTER VIEW All_authors (au_fname, au_lname, address, city, zip)
AS
SELECT au_fname, au_lname, address, city, zip
FROM pubs..authors
WHERE state = 'UT'
GO
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货