The notation for documentation means the following:
{ }
or < >
: what’s inside of keys is obligatory, should be used
{ x | y }
or < x | y >
: an option, x or y, shall be chosen obligatory
[ ]
: what’s inside the brackets is optional, may or may not be using
Here more details about the notation used in the syntax: Sintax Notation
Analyzing your example:
1 BEGIN { TRAN | TRANSACTION }
2 [ { transaction_name | @tran_name_variable }
3 [ WITH MARK [ 'description' ] ]
4 ]
5 [ ; ]
- The command begins with
BEGIN
and must obligatorily be followed by one of the options or TRAN
(abridged version) or TRANSACTION
- The
[
indicates that it is optional declare or not variable
- IS optional declare or not
WITH MARK
and still is optional the description
- This bracket closes what was opened on line 2
- IS optional close with the
;
Another example is the SELECT command:
SELECT [ ALL | DISTINCT ]
[TOP ( expression ) [PERCENT] [ WITH TIES ] ]
< select_list >
[ INTO new_table ]
[ FROM { <table_source> } [ ,...n ] ]
[ WHERE <search_condition> ]
[ <GROUP BY> ]
[ HAVING < search_condition > ]
See that in command SELECT
, use ALL
or DISTINCT
is optional, as well as INTO
and WHERE
for example, but the < select_list >
is mandatory, i.e., the list of fields, variables or values of the command SELECT
A simple SELECT 1
so it works, based on the syntax description above :)
The use of keys is a binding field grouping and serves to indicate the available options. In this case you have TRAN and TRANSACTION divided by pipe, which indicates that you can use the abbreviation or the full name. use of brackets indicates something optional.
– MauroAlmeida
The origin of the notation is in the BNF or Backus-Naur Form: https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form
– José Diz