I use Microsoft SQL Azure (RTM) - 12.0.2000.8 Nov 29 2017 09:37:51 Copyright (C) 2017 Microsoft Corporationwith compatibilty_level = 120 and when I run this request
ALTER PROCEDURE SPCreateSession3
@a int,
@b int
AS
select count(*) as a from events where IDevent > @a;
select count(*) as b from sessions where IDsession > @b;
GO
exec SPCreateSession3 1, 1
This gives me an error Must declare the scalar variable @b. Without a semicolon, it works fine. It seems to ;contain some command GO. Then why did many people suggest here that it ;will never cause any problems. I need a semicolon because I use the MERGE command in reality, which is required ;. Also, if I complete queries in a BEGIN Block, for example
ALTER PROCEDURE SPCreateSession3
@a int,
@b int
AS
BEGIN
select count(*) as a from events where IDevent > @a;
select count(*) as b from sessions where IDsession > @b;
END
GO
exec SPCreateSession3 1, 1
sql incorrect syntax near ;. - . - , ? , - ?
: 