简体   繁体   中英

How to Update View in SQL Server 2005

I want to update the existing view without dropping it, can you just provide me the syntax how to do it..?

Existing view:

CREATE VIEW V1 AS SELECT EMP_ID,NAME FROM EMP_TABLE

I want to update V1 as:

SELECT EMP_ID,NAME, SALARY WHERE SALARY>10000

It's as simple as:

ALTER VIEW V1 AS
  SELECT EMP_ID,NAME, SALARY WHERE SALARY > 10000;

如果您将来忘记了这一点,您可以随时右键单击SQL Server Management Studio中的视图并选择“修改”,这将为您提供当前查询,并使用正确的语法来更改它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM