Skip to content

Commit

Permalink
[TSql] Add support for 'create or replace view' syntax (#3605)
Browse files Browse the repository at this point in the history
  • Loading branch information
olebhansen authored Jul 12, 2023
1 parent 636a6d9 commit 3f91b22
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sql/tsql/TSqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -2364,7 +2364,7 @@ create_table_index_option

// https://msdn.microsoft.com/en-us/library/ms187956.aspx
create_view
: (CREATE (OR ALTER)? | ALTER) VIEW simple_name ('(' column_name_list ')')?
: (CREATE (OR (ALTER | REPLACE))? | ALTER) VIEW simple_name ('(' column_name_list ')')?
(WITH view_attribute (',' view_attribute)*)?
AS select_statement_standalone (WITH CHECK OPTION)? ';'?
;
Expand Down
11 changes: 11 additions & 0 deletions sql/tsql/examples/ddl_create_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@ SELECT
FROM xyz
;
GO

CREATE OR REPLACE VIEW xyz_view
AS
SELECT
ccc,
xxx,
yyy
zzz
FROM xyz
;
GO

0 comments on commit 3f91b22

Please sign in to comment.