In Oracle, I can re-create a view with a single statement, as shown here:
CREATE OR REPLACE VIEW MY_VIEW AS
SELECT SOME_FIELD
FROM SOME_TABLE
WHERE SOME_CONDITIONS
As the syntax implies, this will drop the old view and re-create it with whatever definition I’ve given.
Is there an equivalent in MSSQL (SQL Server 2005 or later) that will do the same thing?
The solutions above though they will get the job done do so at the risk of dropping user permissions. I prefer to do my create or replace views or stored procedures as follows.