-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Declaration in Stored Procedure is used to prepend further statements => Error #44
Comments
I already located the problem near tsql.py:115:
|
Here is a failing testcase: 58a61a7 |
I am trying to reliably detect whether
|
Why is the expectation that this SQL code should result in @declare statement to be unconditionally copied? def test_declaration_in_control_flow():
seed = """
IF 1 = 1
DECLARE @A INT = 5
SELECT * FROM x If it is, we might have to parse the IF statement outcome: IF 1 = 0
DECLARE @A INT = 5
GO
SELECT @A The second with DECLARE @A INT = 5
GO
SELECT @A |
In case of isolate_top_level_statements=True, copy DECLARE statements to subsequent statements only if they are top level.
Declarations in stored procedures can be defined using stored procedure arguments. Pytsql currently still copies them to prefix batches with isolate_top_level_statements=True which causes errors.
TSQL:
Error:
The text was updated successfully, but these errors were encountered: