Reputation: 617
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
Upvotes: 3
Views: 7366
Reputation: 107267
It's as simple as:
ALTER VIEW V1 AS
SELECT EMP_ID,NAME, SALARY WHERE SALARY > 10000;
Upvotes: 5
Reputation: 4241
If you forget this in the future, you can always right click on the view in SQL Server Management Studio and select 'Modify' this will give you the current query, with the correct syntax for altering it.
Upvotes: 1