-
-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
T-SQL support default params and no RETURN value (#2434)
* T-SQL ddetails params and no RETURN value * Review feedback Co-authored-by: Barry Hart <barrywhart@yahoo.com>
- Loading branch information
1 parent
172a8f7
commit 6ccaaa9
Showing
5 changed files
with
190 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
create or alter procedure name | ||
@param1 nvarchar(10) = 'test', | ||
@param2 int = 21 | ||
as begin | ||
return 1; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# YML test files are auto-generated from SQL files and should not be edited by | ||
# hand. To help enforce this, the "hash" field in the file must match a hash | ||
# computed by SQLFluff when running the tests. Please run | ||
# `python test/generate_parse_fixture_yml.py` to generate them after adding or | ||
# altering SQL files. | ||
_hash: 2501cb05d43246a910e1715a625e9329547f0246615cce94560e3f5bf18bc535 | ||
file: | ||
batch: | ||
create_procedure_statement: | ||
- keyword: create | ||
- binary_operator: or | ||
- keyword: alter | ||
- keyword: procedure | ||
- object_reference: | ||
identifier: name | ||
- function_parameter_list: | ||
- parameter: '@param1' | ||
- data_type: | ||
identifier: nvarchar | ||
bracketed: | ||
start_bracket: ( | ||
expression: | ||
literal: '10' | ||
end_bracket: ) | ||
- comparison_operator: | ||
raw_comparison_operator: '=' | ||
- expression: | ||
literal: "'test'" | ||
- comma: ',' | ||
- parameter: '@param2' | ||
- data_type: | ||
identifier: int | ||
- comparison_operator: | ||
raw_comparison_operator: '=' | ||
- expression: | ||
literal: '21' | ||
- keyword: as | ||
- procedure_statement: | ||
statement: | ||
begin_end_block: | ||
- keyword: begin | ||
- statement: | ||
return_segment: | ||
keyword: return | ||
expression: | ||
literal: '1' | ||
statement_terminator: ; | ||
- keyword: end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CREATE PROCEDURE findjobs @nm sysname = NULL | ||
AS | ||
IF @nm IS NULL | ||
BEGIN | ||
PRINT 'You must give a user name' | ||
RETURN | ||
END | ||
ELSE | ||
BEGIN | ||
SELECT o.name, o.id, o.uid | ||
FROM sysobjects o INNER JOIN master..syslogins l | ||
ON o.uid = l.sid | ||
WHERE l.name = @nm | ||
END; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# YML test files are auto-generated from SQL files and should not be edited by | ||
# hand. To help enforce this, the "hash" field in the file must match a hash | ||
# computed by SQLFluff when running the tests. Please run | ||
# `python test/generate_parse_fixture_yml.py` to generate them after adding or | ||
# altering SQL files. | ||
_hash: 421175885d34b10910511e8d2a7a277da2928fd4fa4ae698210aac7159928a59 | ||
file: | ||
batch: | ||
create_procedure_statement: | ||
- keyword: CREATE | ||
- keyword: PROCEDURE | ||
- object_reference: | ||
identifier: findjobs | ||
- function_parameter_list: | ||
parameter: '@nm' | ||
data_type: | ||
identifier: sysname | ||
comparison_operator: | ||
raw_comparison_operator: '=' | ||
expression: | ||
literal: 'NULL' | ||
- keyword: AS | ||
- procedure_statement: | ||
statement: | ||
if_then_statement: | ||
- if_clause: | ||
keyword: IF | ||
expression: | ||
- column_reference: | ||
parameter: '@nm' | ||
- keyword: IS | ||
- keyword: 'NULL' | ||
- statement: | ||
begin_end_block: | ||
- keyword: BEGIN | ||
- statement: | ||
print_statement: | ||
keyword: PRINT | ||
expression: | ||
literal: "'You must give a user name'" | ||
- statement: | ||
return_segment: | ||
keyword: RETURN | ||
- keyword: END | ||
- keyword: ELSE | ||
- statement: | ||
begin_end_block: | ||
- keyword: BEGIN | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
- keyword: SELECT | ||
- select_clause_element: | ||
column_reference: | ||
- identifier: o | ||
- dot: . | ||
- identifier: name | ||
- comma: ',' | ||
- select_clause_element: | ||
column_reference: | ||
- identifier: o | ||
- dot: . | ||
- identifier: id | ||
- comma: ',' | ||
- select_clause_element: | ||
column_reference: | ||
- identifier: o | ||
- dot: . | ||
- identifier: uid | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: sysobjects | ||
alias_expression: | ||
identifier: o | ||
join_clause: | ||
- keyword: INNER | ||
- keyword: JOIN | ||
- from_expression_element: | ||
table_expression: | ||
table_reference: | ||
- identifier: master | ||
- dot: . | ||
- dot: . | ||
- identifier: syslogins | ||
alias_expression: | ||
identifier: l | ||
- join_on_condition: | ||
keyword: 'ON' | ||
expression: | ||
- column_reference: | ||
- identifier: o | ||
- dot: . | ||
- identifier: uid | ||
- comparison_operator: | ||
raw_comparison_operator: '=' | ||
- column_reference: | ||
- identifier: l | ||
- dot: . | ||
- identifier: sid | ||
where_clause: | ||
keyword: WHERE | ||
expression: | ||
- column_reference: | ||
- identifier: l | ||
- dot: . | ||
- identifier: name | ||
- comparison_operator: | ||
raw_comparison_operator: '=' | ||
- column_reference: | ||
parameter: '@nm' | ||
- keyword: END | ||
- statement_terminator: ; |