From this answer here I understand that using GO
after CTE creation and before CREATE VIEW
should in theory deal with the error of:
CREATE VIEW MUST BE THE ONLY STATEMENT IN THE BATCH
However I am receiving an Incorrect Syntax Near GO
error now and im not sure for what reason.
My code is simplified below but all ;() punctuation is how I have it
with RESULT1 as (
code here
),
with RESULT2 as (
code here
),
with RESULT3 as (
code here
),
with RESULT4 as (
code here
)
GO
create view TestingView as
select RESULT4.*
from RESULT4