This Code:
BEGIN
CREATE VIEW [dbo].[dummy] AS SELECT 1 AS Dummy
END
GO
Does not work, returning the error: Incorrect syntax near the keyword 'VIEW'.
Why?
Notes:
The presence of the GO statement seems to make no difference
The inner statement works fine outside of the code block delimiters.
This is part of a larger query but tested in isolation just as it is presented here.