question

Jenmar22 avatar image
Jenmar22 asked

Syntax for replacing a view

I am trying to add a column into an existing view named CURRENT PRODUCT LIST. The column exists in the table that the view was created from. When I try to replace the view using the following syntax, REPLACE VIEW [CURRENT PRODUCT LIST] AS SELECT ProductID, ProductName, ProductLoc FROM dbo.OuterWear WHERE ProductLoc = Groveport; GO I get the following error message. Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'VIEW'. Any suggestions for how I might accomplish this? Thank you in advance for your help!
viewsyntax
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
The site runs on voting. Please indicate all helpful answers by clicking on the thumbs up symbols next to those answers. Please indicate any one answer that lead to the best solution by clicking on the check mark next to that answer.
0 Likes 0 ·
Dugi avatar image
Dugi answered
Replace View will not work for the SQL, it works for Oracle. In SQL Server you need to write ALTER VIEW instead of Replace!
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeff Moden avatar image
Jeff Moden answered
As with the other post on a similar subject, I strongly recommend that learn how to use Books Online and then use it. These are basic questions that a bit of self study on your part will take care of. The other thing to remember is that "SQL is NOT SQL". Despite the best attempts at ANSI and ISO compliance, no RDBMS engine follows all the rules nor do they have identical syntax in all cases. Oracle and SQL server are great examples of how far apart the language for two RDBMSs can actually be. It'll also save you a whole lot of time because, once you've learned a little about what to look for, finding answers in Books Online is a whole lot faster than posting a question and hoping someone answers it for you.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.