@@ -161,3 +161,44 @@ def get_table(
161
161
engine : Engine , table_name : str , schema : Optional [str ] = None
162
162
) -> sa .Table :
163
163
return sa .Table (table_name , sa .MetaData (), autoload_with = engine , schema = schema )
164
+
165
+
166
+ def test_stored_procedure_declaration (engine ):
167
+ statement = """
168
+ DROP DATABASE IF EXISTS stored_procedure_declaration
169
+ CREATE DATABASE stored_procedure_declaration
170
+ USE stored_procedure_declaration
171
+ GO
172
+ /****** Object: Table [dbo].[table1] Script Date: 2/23/2021 2:48:02 PM ******/
173
+ CREATE PROCEDURE CREATEALLDATES
174
+ (
175
+ @StartDate AS DATE, @EndDate AS DATE
176
+ ) AS
177
+ DECLARE @Current AS DATE = DATEADD(DD, 0, @StartDate); DROP TABLE IF EXISTS ##alldates CREATE TABLE ##alldates (
178
+ dt DATE PRIMARY KEY
179
+ ) WHILE @Current <= @EndDate BEGIN
180
+ INSERT INTO ##alldates
181
+ VALUES (@Current);
182
+ SET @Current = DATEADD(DD, 1, @Current) -- add 1 to current day
183
+ END
184
+ GO
185
+ IF OBJECT_ID ( N'dbo.get_db_sampling_factor' , N'FN' ) IS NOT NULL DROP FUNCTION get_db_sampling_factor ;
186
+ GO
187
+ """
188
+ executes (statement , engine , None )
189
+
190
+
191
+ def test_top_level_declaration (engine ):
192
+ statement = """
193
+ DROP DATABASE IF EXISTS top_level_declaration
194
+ CREATE DATABASE top_level_declaration
195
+ USE top_level_declaration
196
+ GO
197
+ DECLARE @Current AS DATE = '2022-01-01'
198
+ GO
199
+ SELECT @Current as a INTO dummy01
200
+ GO
201
+ SELECT @Current as b INTO dummy02
202
+ GO
203
+ """
204
+ executes (statement , engine , None )
0 commit comments