Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I'm trying to create a VIEW in my database, and it shows me
VIEW
"Incorrent syntax error"
Am I doing something wrong?
CREATE VIEW
Include GO between your Create View and Select query (or) view should be the only statement.
CREATE VIEW [dbo].[View_name] As -- view logic GO Select * from table
Add a comment
You selected two select statements. You should run only statement starting from Create View till where clause.
create view view_name as select id from tab where id = some_id;
Just run one statement of create view that's it.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
CREATE VIEWmust be the only statement in the batch. (Which would be the error if you hover your mouse over the red squiggly line)