I am making use of variables in my TSQL queries. As my script has grown, I have separated each part by GO, now the problem is I need access to variables at the top of my script.
How can I still access these variables?
Hopefully, this is something simple and straightforward.
Thanks all
GO is used to separate batch of t-sql, Variables have local scope and are only visible within the batch or procedure where they are defined.
Your best best is probably to store the global stuff in a temp table, or if they are constant create a stored proc. to pull them at runtime.