I'm trying to batch some SQL scripts. At the top I've declared some variables which I deem global in the sense of the term
So:
DECLARE @someVar1
DECLARE @someVar2
...etc.
GO
Some batch of SQL here that sets @someVar1 and @SomeVar2 to a value and uses it in the SQL statement
GO
Some batch of SQL here that sets @someVar1 and @SomeVar2 to a value and uses it in the SQL statement
GO
...
the declarations are out of scope...meaning when I run this, the subsequent batch scripts do not find those declarations. Is there a way to keep them global for all batch scripts that are utilizing or setting these variables for use?