I am running a CREATE VIEW statement which is perfectly self-contained and runs perfect on its own. Two lines below I run a separate SELECT statement to view the results, which works perfect on its own.
However, I run the whole script together and it doesn't work.
Code looks something like this:
--- These four lines run fine on their own.
CREATE OR ALTER VIEW view1 AS
SELECT column1, column2, column3
FROM table1;
--- This line runs fine on its own
SELECT * FROM view1
--- If I run the whole script it doesn't work
The error message is "Incorrect syntax near the keyword 'SELECT'."