/*
T-SQL (Transact-SQL, MSSQL) grammar.
The MIT License (MIT).
Copyright (c) 2017, Mark Adams (madams51703@gmail.com)
Copyright (c) 2015-2017, Ivan Kochurkin (kvanttt@gmail.com), Positive Technologies.
Copyright (c) 2016, Scott Ure (scott@redstormsoftware.com).
Copyright (c) 2016, Rui Zhang (ruizhang.ccs@gmail.com).
Copyright (c) 2016, Marcus Henriksson (kuseman80@gmail.com).
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

lexer grammar TSqlLexer;

// Basic keywords (from https://msdn.microsoft.com/en-us/library/ms189822.aspx)

/*options { caseInsensitive = true; }*/

ADD:                                   'ADD';
ALL:                                   'ALL';
ALTER:                                 'ALTER';
AND:                                   'AND';
ANY:                                   'ANY';
AS:                                    'AS';
ASC:                                   'ASC';
AUTHORIZATION:                         'AUTHORIZATION';
ACCELERATED_DATABASE_RECOVERY:         'ACCELERATED_DATABASE_RECOVERY';
BACKSLASH:                             '\\';
BACKUP:                                'BACKUP';
BEGIN:                                 'BEGIN';
BETWEEN:                               'BETWEEN';
BREAK:                                 'BREAK';
BROWSE:                                'BROWSE';
BULK:                                  'BULK';
BY:                                    'BY';
CASCADE:                               'CASCADE';
CASE:                                  'CASE';
CHECK:                                 'CHECK';
CHECKPOINT:                            'CHECKPOINT';
CLOSE:                                 'CLOSE';
CLUSTERED:                             'CLUSTERED';
COALESCE:                              'COALESCE';
COLLATE:                               'COLLATE';
COLUMN:                                'COLUMN';
COMMIT:                                'COMMIT';
COMPUTE:                               'COMPUTE';
CONSTRAINT:                            'CONSTRAINT';
CONTAINS:                              'CONTAINS';
CONTAINSTABLE:                         'CONTAINSTABLE';
CONTINUE:                              'CONTINUE';
CONVERT:                               'TRY_'? 'CONVERT';
CREATE:                                'CREATE';
CROSS:                                 'CROSS';
CURRENT:                               'CURRENT';
CURRENT_DATE:                          'CURRENT_DATE';
CURRENT_TIME:                          'CURRENT_TIME';
CURRENT_TIMESTAMP:                     'CURRENT_TIMESTAMP';
CURRENT_USER:                          'CURRENT_USER';
CURSOR:                                'CURSOR';
DATABASE:                              'DATABASE';
DBCC:                                  'DBCC';
DEALLOCATE:                            'DEALLOCATE';
DECLARE:                               'DECLARE';
DEFAULT:                               'DEFAULT';
DELETE:                                'DELETE';
DENY:                                  'DENY';
DESC:                                  'DESC';
DISK:                                  'DISK';
DISTINCT:                              'DISTINCT';
DISTRIBUTED:                           'DISTRIBUTED';
DOUBLE:                                'DOUBLE';
DOUBLE_BACK_SLASH:                     '\\\\';
DOUBLE_FORWARD_SLASH:                  '//';
DROP:                                  'DROP';
DUMP:                                  'DUMP';
ELSE:                                  'ELSE';
END:                                   'END';
ERRLVL:                                'ERRLVL';
ESCAPE:                                'ESCAPE';
EXCEPT:                                'EXCEPT';
EXECUTE:                               'EXEC' 'UTE'?;
EXISTS:                                'EXISTS';
EXIT:                                  'EXIT';
EXTERNAL:                              'EXTERNAL';
FETCH:                                 'FETCH';
FILE:                                  'FILE';
FILLFACTOR:                            'FILLFACTOR';
FOR:                                   'FOR';
FOREIGN:                               'FOREIGN';
FREETEXT:                              'FREETEXT';
FREETEXTTABLE:                         'FREETEXTTABLE';
FROM:                                  'FROM';
FULL:                                  'FULL';
FUNCTION:                              'FUNCTION';
GOTO:                                  'GOTO';
GRANT:                                 'GRANT';
GROUP:                                 'GROUP';
HAVING:                                'HAVING';
HOLDLOCK:                              'HOLDLOCK';
IDENTITY:                              'IDENTITY';
IDENTITY_INSERT:                       'IDENTITY_INSERT';
IDENTITYCOL:                           'IDENTITYCOL';
IF:                                    'IF';
IN:                                    'IN';
INDEX:                                 'INDEX';
INNER:                                 'INNER';
INSERT:                                'INSERT';
INTERSECT:                             'INTERSECT';
INTO:                                  'INTO';
IS:                                    'IS';
JOIN:                                  'JOIN';
KEY:                                   'KEY';
KILL:                                  'KILL';
LEFT:                                  'LEFT';
LIKE:                                  'LIKE';
LINENO:                                'LINENO';
LOAD:                                  'LOAD';
MERGE:                                 'MERGE';
NATIONAL:                              'NATIONAL';
NEGOTIATE:                             'NEGOTIATE';
NOCHECK:                               'NOCHECK';
NOHOLDLOCK:                            'NOHOLDLOCK';
NONCLUSTERED:                          'NONCLUSTERED';
NOT:                                   'NOT';
NULL_:                                 'NULL';
NULLIF:                                'NULLIF';
OF:                                    'OF';
OFF:                                   'OFF';
OFFSETS:                               'OFFSETS';
ON:                                    'ON';
OPEN:                                  'OPEN';
OPENDATASOURCE:                        'OPENDATASOURCE';
OPENQUERY:                             'OPENQUERY';
OPENROWSET:                            'OPENROWSET';
OPENXML:                               'OPENXML';
OPTION:                                'OPTION';
OR:                                    'OR';
ORDER:                                 'ORDER';
OUTER:                                 'OUTER';
OVER:                                  'OVER';
PARSE:                                 'TRY_'? 'PARSE';
PERCENT:                               'PERCENT';
PIVOT:                                 'PIVOT';
PLAN:                                  'PLAN';
PRECISION:                             'PRECISION';
PRIMARY:                               'PRIMARY';
PRINT:                                 'PRINT';
PROC:                                  'PROC';
PROCEDURE:                             'PROCEDURE';
PUBLIC:                                'PUBLIC';
RAISERROR:                             'RAISERROR';
RAW:                                   'RAW';
READ:                                  'READ';
READTEXT:                              'READTEXT';
RECONFIGURE:                           'RECONFIGURE';
REFERENCES:                            'REFERENCES';
REPLICATION:                           'REPLICATION';
RESTORE:                               'RESTORE';
RESTRICT:                              'RESTRICT';
RETURN:                                'RETURN';
REVERT:                                'REVERT';
REVOKE:                                'REVOKE';
RIGHT:                                 'RIGHT';
ROLLBACK:                              'ROLLBACK';
ROWCOUNT:                              'ROWCOUNT';
ROWGUIDCOL:                            'ROWGUIDCOL';
RULE:                                  'RULE';
SAVE:                                  'SAVE';
SCHEMA:                                'SCHEMA';
SECURITYAUDIT:                         'SECURITYAUDIT';
SELECT:                                'SELECT';
SEMANTICKEYPHRASETABLE:                'SEMANTICKEYPHRASETABLE';
SEMANTICSIMILARITYDETAILSTABLE:        'SEMANTICSIMILARITYDETAILSTABLE';
SEMANTICSIMILARITYTABLE:               'SEMANTICSIMILARITYTABLE';
SESSION_USER:                          'SESSION_USER';
SET:                                   'SET';
SETS:                                  'SETS';
SETUSER:                               'SETUSER';
SHUTDOWN:                              'SHUTDOWN';
SOME:                                  'SOME';
STATISTICS:                            'STATISTICS';
SYSTEM_USER:                           'SYSTEM_USER';
TABLE:                                 'TABLE';
TABLESAMPLE:                           'TABLESAMPLE';
TEXTSIZE:                              'TEXTSIZE';
THEN:                                  'THEN';
TO:                                    'TO';
TOP:                                   'TOP';
TRAN:                                  'TRAN';
TRANSACTION:                           'TRANSACTION';
TRIGGER:                               'TRIGGER';
TRUNCATE:                              'TRUNCATE';
TSEQUAL:                               'TSEQUAL';
UNION:                                 'UNION';
UNIQUE:                                'UNIQUE';
UNPIVOT:                               'UNPIVOT';
UPDATE:                                'UPDATE';
UPDATETEXT:                            'UPDATETEXT';
USE:                                   'USE';
USER:                                  'USER';
VALUES:                                'VALUES';
VARYING:                               'VARYING';
VIEW:                                  'VIEW';
WAITFOR:                               'WAITFOR';
WHEN:                                  'WHEN';
WHERE:                                 'WHERE';
WHILE:                                 'WHILE';
WITH:                                  'WITH';
WITHIN:                                'WITHIN';
WRITETEXT:                             'WRITETEXT';
DOLLAR_PARTITION:                      '$PARTITION';

//Keywords that can exist in ID etc
ABORT:                                 'ABORT';
ABSOLUTE:                              'ABSOLUTE';
ACCENT_SENSITIVITY:                    'ACCENT_SENSITIVITY';
ACCESS:                                'ACCESS';
ACTION:                                'ACTION';
ACTIVATION:                            'ACTIVATION';
ACTIVE:                                'ACTIVE';
ADDRESS:                               'ADDRESS';
AES_128:                               'AES_128';
AES_192:                               'AES_192';
AES_256:                               'AES_256';
AFFINITY:                              'AFFINITY';
AFTER:                                 'AFTER';
AGGREGATE:                             'AGGREGATE';
ALGORITHM:                             'ALGORITHM';
ALL_CONSTRAINTS:                       'ALL_CONSTRAINTS';
ALL_ERRORMSGS:                         'ALL_ERRORMSGS';
ALL_INDEXES:                           'ALL_INDEXES';
ALL_LEVELS:                            'ALL_LEVELS';
ALLOW_ENCRYPTED_VALUE_MODIFICATIONS:   'ALLOW_ENCRYPTED_VALUE_MODIFICATIONS';
ALLOW_PAGE_LOCKS:                      'ALLOW_PAGE_LOCKS';
ALLOW_ROW_LOCKS:                       'ALLOW_ROW_LOCKS';
ALLOW_SNAPSHOT_ISOLATION:              'ALLOW_SNAPSHOT_ISOLATION';
ALLOWED:                               'ALLOWED';
ANSI_DEFAULTS:                         'ANSI_DEFAULTS';
ALWAYS:                                'ALWAYS';
ANSI_NULL_DEFAULT:                     'ANSI_NULL_DEFAULT';
ANSI_NULL_DFLT_OFF:                    'ANSI_NULL_DFLT_OFF';
ANSI_NULL_DFLT_ON:                     'ANSI_NULL_DFLT_ON';
ANSI_NULLS:                            'ANSI_NULLS';
ANSI_PADDING:                          'ANSI_PADDING';
ANSI_WARNINGS:                         'ANSI_WARNINGS';
APP_NAME:                              'APP_NAME';
APPLICATION_LOG:                       'APPLICATION_LOG';
APPLOCK_MODE:                          'APPLOCK_MODE';
APPLOCK_TEST:                          'APPLOCK_TEST';
APPLY:                                 'APPLY';
ARITHABORT:                            'ARITHABORT';
ARITHIGNORE:                           'ARITHIGNORE';
ASCII:                                 'ASCII';
ASSEMBLY:                              'ASSEMBLY';
ASSEMBLYPROPERTY:                      'ASSEMBLYPROPERTY';
AT_KEYWORD:                            'AT';
AUDIT:                                 'AUDIT';
AUDIT_GUID:                            'AUDIT_GUID';
AUTO:                                  'AUTO';
AUTO_CLEANUP:                          'AUTO_CLEANUP';
AUTO_CLOSE:                            'AUTO_CLOSE';
AUTO_CREATE_STATISTICS:                'AUTO_CREATE_STATISTICS';
AUTO_DROP:                             'AUTO_DROP';
AUTO_SHRINK:                           'AUTO_SHRINK';
AUTO_UPDATE_STATISTICS:                'AUTO_UPDATE_STATISTICS';
AUTO_UPDATE_STATISTICS_ASYNC:          'AUTO_UPDATE_STATISTICS_ASYNC';
AUTOGROW_ALL_FILES:                    'AUTOGROW_ALL_FILES';
AUTOGROW_SINGLE_FILE:                  'AUTOGROW_SINGLE_FILE';
AVAILABILITY:                          'AVAILABILITY';
AVG:                                   'AVG';
BACKUP_CLONEDB:                        'BACKUP_CLONEDB';
BACKUP_PRIORITY:                       'BACKUP_PRIORITY';
BASE64:                                'BASE64';
BEGIN_DIALOG:                          'BEGIN_DIALOG';
BIGINT:                                'BIGINT';
BINARY_KEYWORD:                        'BINARY';
BINARY_CHECKSUM:                       'BINARY_CHECKSUM';
BINDING:                               'BINDING';
BLOB_STORAGE:                          'BLOB_STORAGE';
BROKER:                                'BROKER';
BROKER_INSTANCE:                       'BROKER_INSTANCE';
BULK_LOGGED:                           'BULK_LOGGED';
CALLER:                                'CALLER';
CAP_CPU_PERCENT:                       'CAP_CPU_PERCENT';
CAST:                                  'CAST';
TRY_CAST:                              'TRY_CAST';
CATALOG:                               'CATALOG';
CATCH:                                 'CATCH';
CERT_ID:                               'CERT_ID';
CERTENCODED:                           'CERTENCODED';
CERTPRIVATEKEY:                        'CERTPRIVATEKEY';
CHANGE:                                'CHANGE';
CHANGE_RETENTION:                      'CHANGE_RETENTION';
CHANGE_TRACKING:                       'CHANGE_TRACKING';
CHAR:                                  'CHAR';
CHARINDEX:                             'CHARINDEX';
CHECKALLOC:                            'CHECKALLOC';
CHECKCATALOG:                          'CHECKCATALOG';
CHECKCONSTRAINTS:                      'CHECKCONSTRAINTS';
CHECKDB:                               'CHECKDB';
CHECKFILEGROUP:                        'CHECKFILEGROUP';
CHECKSUM:                              'CHECKSUM';
CHECKSUM_AGG:                          'CHECKSUM_AGG';
CHECKTABLE:                            'CHECKTABLE';
CLEANTABLE:                            'CLEANTABLE';
CLEANUP:                               'CLEANUP';
CLONEDATABASE:                         'CLONEDATABASE';
COL_LENGTH:                            'COL_LENGTH';
COL_NAME:                              'COL_NAME';
COLLECTION:                            'COLLECTION';
COLUMN_ENCRYPTION_KEY:                 'COLUMN_ENCRYPTION_KEY';
COLUMN_MASTER_KEY:                     'COLUMN_MASTER_KEY';
COLUMNPROPERTY:                        'COLUMNPROPERTY';
COLUMNS:                               'COLUMNS';
COLUMNSTORE:                           'COLUMNSTORE';
COLUMNSTORE_ARCHIVE:                   'COLUMNSTORE_ARCHIVE';
COMMITTED:                             'COMMITTED';
COMPATIBILITY_LEVEL:                   'COMPATIBILITY_LEVEL';
COMPRESS_ALL_ROW_GROUPS:               'COMPRESS_ALL_ROW_GROUPS';
COMPRESSION_DELAY:                     'COMPRESSION_DELAY';
CONCAT:                                'CONCAT';
CONCAT_WS:                             'CONCAT_WS';
CONCAT_NULL_YIELDS_NULL:               'CONCAT_NULL_YIELDS_NULL';
CONTENT:                               'CONTENT';
CONTROL:                               'CONTROL';
COOKIE:                                'COOKIE';
COUNT:                                 'COUNT';
COUNT_BIG:                             'COUNT_BIG';
COUNTER:                               'COUNTER';
CPU:                                   'CPU';
CREATE_NEW:                            'CREATE_NEW';
CREATION_DISPOSITION:                  'CREATION_DISPOSITION';
CREDENTIAL:                            'CREDENTIAL';
CRYPTOGRAPHIC:                         'CRYPTOGRAPHIC';
CUME_DIST:                             'CUME_DIST';
CURSOR_CLOSE_ON_COMMIT:                'CURSOR_CLOSE_ON_COMMIT';
CURSOR_DEFAULT:                        'CURSOR_DEFAULT';
CURSOR_STATUS:                         'CURSOR_STATUS';
DATA:                                  'DATA';
DATA_PURITY:                           'DATA_PURITY';
DATABASE_PRINCIPAL_ID:                 'DATABASE_PRINCIPAL_ID';
DATABASEPROPERTYEX:                    'DATABASEPROPERTYEX';
DATALENGTH:                            'DATALENGTH';
DATE_CORRELATION_OPTIMIZATION:         'DATE_CORRELATION_OPTIMIZATION';
DATEADD:                               'DATEADD';
DATEDIFF:                              'DATEDIFF';
DATENAME:                              'DATENAME';
DATEPART:                              'DATEPART';
DAYS:                                  'DAYS';
DB_CHAINING:                           'DB_CHAINING';
DB_FAILOVER:                           'DB_FAILOVER';
DB_ID:                                 'DB_ID';
DB_NAME:                               'DB_NAME';
DBREINDEX:                             'DBREINDEX';
DECRYPTION:                            'DECRYPTION';
DEFAULT_DOUBLE_QUOTE:                  ["]'DEFAULT'["];
DEFAULT_FULLTEXT_LANGUAGE:             'DEFAULT_FULLTEXT_LANGUAGE';
DEFAULT_LANGUAGE:                      'DEFAULT_LANGUAGE';
DEFINITION:                            'DEFINITION';
DELAY:                                 'DELAY';
DELAYED_DURABILITY:                    'DELAYED_DURABILITY';
DELETED:                               'DELETED';
DENSE_RANK:                            'DENSE_RANK';
DEPENDENTS:                            'DEPENDENTS';
DES:                                   'DES';
DESCRIPTION:                           'DESCRIPTION';
DESX:                                  'DESX';
DETERMINISTIC:                         'DETERMINISTIC';
DHCP:                                  'DHCP';
DIALOG:                                'DIALOG';
DIFFERENCE:                            'DIFFERENCE';
DIRECTORY_NAME:                        'DIRECTORY_NAME';
DISABLE:                               'DISABLE';
DISABLE_BROKER:                        'DISABLE_BROKER';
DISABLED:                              'DISABLED';
DOCUMENT:                              'DOCUMENT';
DROP_EXISTING:                         'DROP_EXISTING';
DROPCLEANBUFFERS:                      'DROPCLEANBUFFERS';
DYNAMIC:                               'DYNAMIC';
ELEMENTS:                              'ELEMENTS';
EMERGENCY:                             'EMERGENCY';
EMPTY:                                 'EMPTY';
ENABLE:                                'ENABLE';
ENABLE_BROKER:                         'ENABLE_BROKER';
ENCRYPTED:                             'ENCRYPTED';
ENCRYPTED_VALUE:                       'ENCRYPTED_VALUE';
ENCRYPTION:                            'ENCRYPTION';
ENCRYPTION_TYPE:                       'ENCRYPTION_TYPE';
ENDPOINT_URL:                          'ENDPOINT_URL';
ERROR_BROKER_CONVERSATIONS:            'ERROR_BROKER_CONVERSATIONS';
ESTIMATEONLY:                          'ESTIMATEONLY';
EXCLUSIVE:                             'EXCLUSIVE';
EXECUTABLE:                            'EXECUTABLE';
EXIST:                                 'EXIST';
EXIST_SQUARE_BRACKET:                  '[EXIST]';
EXPAND:                                'EXPAND';
EXPIRY_DATE:                           'EXPIRY_DATE';
EXPLICIT:                              'EXPLICIT';
EXTENDED_LOGICAL_CHECKS:               'EXTENDED_LOGICAL_CHECKS';
FAIL_OPERATION:                        'FAIL_OPERATION';
FAILOVER_MODE:                         'FAILOVER_MODE';
FAILURE:                               'FAILURE';
FAILURE_CONDITION_LEVEL:               'FAILURE_CONDITION_LEVEL';
FAST:                                  'FAST';
FAST_FORWARD:                          'FAST_FORWARD';
FILE_ID:                               'FILE_ID';
FILE_IDEX:                             'FILE_IDEX';
FILE_NAME:                             'FILE_NAME';
FILEGROUP:                             'FILEGROUP';
FILEGROUP_ID:                          'FILEGROUP_ID';
FILEGROUP_NAME:                        'FILEGROUP_NAME';
FILEGROUPPROPERTY:                     'FILEGROUPPROPERTY';
FILEGROWTH:                            'FILEGROWTH';
FILENAME:                              'FILENAME';
FILEPATH:                              'FILEPATH';
FILEPROPERTY:                          'FILEPROPERTY';
FILEPROPERTYEX:                        'FILEPROPERTYEX';
FILESTREAM:                            'FILESTREAM';
FILTER:                                'FILTER';
FIRST:                                 'FIRST';
FIRST_VALUE:                           'FIRST_VALUE';
FMTONLY:                               'FMTONLY';
FOLLOWING:                             'FOLLOWING';
FORCE:                                 'FORCE';
FORCE_FAILOVER_ALLOW_DATA_LOSS:        'FORCE_FAILOVER_ALLOW_DATA_LOSS';
FORCED:                                'FORCED';
FORCEPLAN:                             'FORCEPLAN';
FORCESCAN:                             'FORCESCAN';
FORMAT:                                'FORMAT';
FORWARD_ONLY:                          'FORWARD_ONLY';
FREE:                                  'FREE';
FULLSCAN:                              'FULLSCAN';
FULLTEXT:                              'FULLTEXT';
FULLTEXTCATALOGPROPERTY:               'FULLTEXTCATALOGPROPERTY';
FULLTEXTSERVICEPROPERTY:               'FULLTEXTSERVICEPROPERTY';
GB:                                    'GB';
GENERATED:                             'GENERATED';
GETDATE:                               'GETDATE';
GETUTCDATE:                            'GETUTCDATE';
GLOBAL:                                'GLOBAL';
GO:                                    'GO';
GREATEST:                              'GREATEST';
GROUP_MAX_REQUESTS:                    'GROUP_MAX_REQUESTS';
GROUPING:                              'GROUPING';
GROUPING_ID:                           'GROUPING_ID';
HADR:                                  'HADR';
HAS_DBACCESS:                          'HAS_DBACCESS';
HAS_PERMS_BY_NAME:                     'HAS_PERMS_BY_NAME';
HASH:                                  'HASH';
HEALTH_CHECK_TIMEOUT:                  'HEALTH_CHECK_TIMEOUT';
HIDDEN_KEYWORD:                        'HIDDEN';
HIGH:                                  'HIGH';
HONOR_BROKER_PRIORITY:                 'HONOR_BROKER_PRIORITY';
HOURS:                                 'HOURS';
IDENT_CURRENT:                         'IDENT_CURRENT';
IDENT_INCR:                            'IDENT_INCR';
IDENT_SEED:                            'IDENT_SEED';
IDENTITY_VALUE:                        'IDENTITY_VALUE';
IGNORE_CONSTRAINTS:                    'IGNORE_CONSTRAINTS';
IGNORE_DUP_KEY:                        'IGNORE_DUP_KEY';
IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX: 'IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX';
IGNORE_REPLICATED_TABLE_CACHE:         'IGNORE_REPLICATED_TABLE_CACHE';
IGNORE_TRIGGERS:                       'IGNORE_TRIGGERS';
IMMEDIATE:                             'IMMEDIATE';
IMPERSONATE:                           'IMPERSONATE';
IMPLICIT_TRANSACTIONS:                 'IMPLICIT_TRANSACTIONS';
IMPORTANCE:                            'IMPORTANCE';
INCLUDE_NULL_VALUES:                   'INCLUDE_NULL_VALUES';
INCREMENTAL:                           'INCREMENTAL';
INDEX_COL:                             'INDEX_COL';
INDEXKEY_PROPERTY:                     'INDEXKEY_PROPERTY';
INDEXPROPERTY:                         'INDEXPROPERTY';
INITIATOR:                             'INITIATOR';
INPUT:                                 'INPUT';
INSENSITIVE:                           'INSENSITIVE';
INSERTED:                              'INSERTED';
INT:                                   'INT';
IP:                                    'IP';
IS_MEMBER:                             'IS_MEMBER';
IS_ROLEMEMBER:                         'IS_ROLEMEMBER';
IS_SRVROLEMEMBER:                      'IS_SRVROLEMEMBER';
ISJSON:                                'ISJSON';
ISOLATION:                             'ISOLATION';
JOB:                                   'JOB';
JSON:                                  'JSON';
JSON_OBJECT:                           'JSON_OBJECT';
JSON_ARRAY:                            'JSON_ARRAY';
JSON_VALUE:                            'JSON_VALUE';
JSON_QUERY:                            'JSON_QUERY';
JSON_MODIFY:                           'JSON_MODIFY';
JSON_PATH_EXISTS:                      'JSON_PATH_EXISTS';
KB:                                    'KB';
KEEP:                                  'KEEP';
KEEPDEFAULTS:                          'KEEPDEFAULTS';
KEEPFIXED:                             'KEEPFIXED';
KEEPIDENTITY:                          'KEEPIDENTITY';
KEY_SOURCE:                            'KEY_SOURCE';
KEYS:                                  'KEYS';
KEYSET:                                'KEYSET';
LAG:                                   'LAG';
LAST:                                  'LAST';
LAST_VALUE:                            'LAST_VALUE';
LEAD:                                  'LEAD';
LEAST:                                 'LEAST';
LEN:                                   'LEN';
LEVEL:                                 'LEVEL';
LIST:                                  'LIST';
LISTENER:                              'LISTENER';
LISTENER_URL:                          'LISTENER_URL';
LOB_COMPACTION:                        'LOB_COMPACTION';
LOCAL:                                 'LOCAL';
LOCATION:                              'LOCATION';
LOCK:                                  'LOCK';
LOCK_ESCALATION:                       'LOCK_ESCALATION';
LOGIN:                                 'LOGIN';
LOGINPROPERTY:                         'LOGINPROPERTY';
LOOP:                                  'LOOP';
LOW:                                   'LOW';
LOWER:                                 'LOWER';
LTRIM:                                 'LTRIM';
MANUAL:                                'MANUAL';
MARK:                                  'MARK';
MASKED:                                'MASKED';
MATERIALIZED:                          'MATERIALIZED';
MAX:                                   'MAX';
MAX_CPU_PERCENT:                       'MAX_CPU_PERCENT';
MAX_DOP:                               'MAX_DOP';
MAX_FILES:                             'MAX_FILES';
MAX_IOPS_PER_VOLUME:                   'MAX_IOPS_PER_VOLUME';
MAX_MEMORY_PERCENT:                    'MAX_MEMORY_PERCENT';
MAX_PROCESSES:                         'MAX_PROCESSES';
MAX_QUEUE_READERS:                     'MAX_QUEUE_READERS';
MAX_ROLLOVER_FILES:                    'MAX_ROLLOVER_FILES';
MAXDOP:                                'MAXDOP';
MAXRECURSION:                          'MAXRECURSION';
MAXSIZE:                               'MAXSIZE';
MB:                                    'MB';
MEDIUM:                                'MEDIUM';
MEMORY_OPTIMIZED_DATA:                 'MEMORY_OPTIMIZED_DATA';
MESSAGE:                               'MESSAGE';
MIN:                                   'MIN';
MIN_ACTIVE_ROWVERSION:                 'MIN_ACTIVE_ROWVERSION';
MIN_CPU_PERCENT:                       'MIN_CPU_PERCENT';
MIN_IOPS_PER_VOLUME:                   'MIN_IOPS_PER_VOLUME';
MIN_MEMORY_PERCENT:                    'MIN_MEMORY_PERCENT';
MINUTES:                               'MINUTES';
MIRROR_ADDRESS:                        'MIRROR_ADDRESS';
MIXED_PAGE_ALLOCATION:                 'MIXED_PAGE_ALLOCATION';
MODE:                                  'MODE';
MODIFY:                                'MODIFY';
MODIFY_SQUARE_BRACKET:                 '[MODIFY]';
MOVE:                                  'MOVE';
MULTI_USER:                            'MULTI_USER';
NAME:                                  'NAME';
NCHAR:                                 'NCHAR';
NESTED_TRIGGERS:                       'NESTED_TRIGGERS';
NEW_ACCOUNT:                           'NEW_ACCOUNT';
NEW_BROKER:                            'NEW_BROKER';
NEW_PASSWORD:                          'NEW_PASSWORD';
NEWNAME:                               'NEWNAME';
NEXT:                                  'NEXT';
NO:                                    'NO';
NO_INFOMSGS:                           'NO_INFOMSGS';
NO_QUERYSTORE:                         'NO_QUERYSTORE';
NO_STATISTICS:                         'NO_STATISTICS';
NO_TRUNCATE:                           'NO_TRUNCATE';
NO_WAIT:                               'NO_WAIT';
NOCOUNT:                               'NOCOUNT';
NODES:                                 'NODES';
NOEXEC:                                'NOEXEC';
NOEXPAND:                              'NOEXPAND';
NOINDEX:                               'NOINDEX';
NOLOCK:                                'NOLOCK';
NON_TRANSACTED_ACCESS:                 'NON_TRANSACTED_ACCESS';
NORECOMPUTE:                           'NORECOMPUTE';
NORECOVERY:                            'NORECOVERY';
NOTIFICATIONS:                         'NOTIFICATIONS';
NOWAIT:                                'NOWAIT';
NTILE:                                 'NTILE';
NULL_DOUBLE_QUOTE:                     ["]'NULL'["];
NUMANODE:                              'NUMANODE';
NUMBER:                                'NUMBER';
NUMERIC_ROUNDABORT:                    'NUMERIC_ROUNDABORT';
OBJECT:                                'OBJECT';
OBJECT_DEFINITION:                     'OBJECT_DEFINITION';
OBJECT_ID:                             'OBJECT_ID';
OBJECT_NAME:                           'OBJECT_NAME';
OBJECT_SCHEMA_NAME:                    'OBJECT_SCHEMA_NAME';
OBJECTPROPERTY:                        'OBJECTPROPERTY';
OBJECTPROPERTYEX:                      'OBJECTPROPERTYEX';
OFFLINE:                               'OFFLINE';
OFFSET:                                'OFFSET';
OLD_ACCOUNT:                           'OLD_ACCOUNT';
ONLINE:                                'ONLINE';
ONLY:                                  'ONLY';
OPEN_EXISTING:                         'OPEN_EXISTING';
OPENJSON:                              'OPENJSON';
OPTIMISTIC:                            'OPTIMISTIC';
OPTIMIZE:                              'OPTIMIZE';
OPTIMIZE_FOR_SEQUENTIAL_KEY:           'OPTIMIZE_FOR_SEQUENTIAL_KEY';
ORIGINAL_DB_NAME:                      'ORIGINAL_DB_NAME';
ORIGINAL_LOGIN:                        'ORIGINAL_LOGIN';
OUT:                                   'OUT';
OUTPUT:                                'OUTPUT';
OVERRIDE:                              'OVERRIDE';
OWNER:                                 'OWNER';
OWNERSHIP:                             'OWNERSHIP';
PAD_INDEX:                             'PAD_INDEX';
PAGE_VERIFY:                           'PAGE_VERIFY';
PAGECOUNT:                             'PAGECOUNT';
PAGLOCK:                               'PAGLOCK';
PARAMETERIZATION:                      'PARAMETERIZATION';
PARSENAME:                             'PARSENAME';
PARSEONLY:                             'PARSEONLY';
PARTITION:                             'PARTITION';
PARTITIONS:                            'PARTITIONS';
PARTNER:                               'PARTNER';
PATH:                                  'PATH';
PATINDEX:                              'PATINDEX';
PAUSE:                                 'PAUSE';
PDW_SHOWSPACEUSED:                     'PDW_SHOWSPACEUSED';
PERCENT_RANK:                          'PERCENT_RANK';
PERCENTILE_CONT:                       'PERCENTILE_CONT';
PERCENTILE_DISC:                       'PERCENTILE_DISC';
PERMISSIONS:                           'PERMISSIONS';
PERSIST_SAMPLE_PERCENT:                'PERSIST_SAMPLE_PERCENT';
PHYSICAL_ONLY:                         'PHYSICAL_ONLY';
POISON_MESSAGE_HANDLING:               'POISON_MESSAGE_HANDLING';
POOL:                                  'POOL';
PORT:                                  'PORT';
PRECEDING:                             'PRECEDING';
PRIMARY_ROLE:                          'PRIMARY_ROLE';
PRIOR:                                 'PRIOR';
PRIORITY:                              'PRIORITY';
PRIORITY_LEVEL:                        'PRIORITY_LEVEL';
PRIVATE:                               'PRIVATE';
PRIVATE_KEY:                           'PRIVATE_KEY';
PRIVILEGES:                            'PRIVILEGES';
PROCCACHE:                             'PROCCACHE';
PROCEDURE_NAME:                        'PROCEDURE_NAME';
PROPERTY:                              'PROPERTY';
PROVIDER:                              'PROVIDER';
PROVIDER_KEY_NAME:                     'PROVIDER_KEY_NAME';
PWDCOMPARE:                            'PWDCOMPARE';
PWDENCRYPT:                            'PWDENCRYPT';
QUERY:                                 'QUERY';
QUERY_SQUARE_BRACKET:                  '[QUERY]';
QUEUE:                                 'QUEUE';
QUEUE_DELAY:                           'QUEUE_DELAY';
QUOTED_IDENTIFIER:                     'QUOTED_IDENTIFIER';
QUOTENAME:                             'QUOTENAME';
RANDOMIZED:                            'RANDOMIZED';
RANGE:                                 'RANGE';
RANK:                                  'RANK';
RC2:                                   'RC2';
RC4:                                   'RC4';
RC4_128:                               'RC4_128';
READ_COMMITTED_SNAPSHOT:               'READ_COMMITTED_SNAPSHOT';
READ_ONLY:                             'READ_ONLY';
READ_ONLY_ROUTING_LIST:                'READ_ONLY_ROUTING_LIST';
READ_WRITE:                            'READ_WRITE';
READCOMMITTED:                         'READCOMMITTED';
READCOMMITTEDLOCK:                     'READCOMMITTEDLOCK';
READONLY:                              'READONLY';
READPAST:                              'READPAST';
READUNCOMMITTED:                       'READUNCOMMITTED';
READWRITE:                             'READWRITE';
REBUILD:                               'REBUILD';
RECEIVE:                               'RECEIVE';
RECOMPILE:                             'RECOMPILE';
RECOVERY:                              'RECOVERY';
RECURSIVE_TRIGGERS:                    'RECURSIVE_TRIGGERS';
RELATIVE:                              'RELATIVE';
REMOTE:                                'REMOTE';
REMOTE_PROC_TRANSACTIONS:              'REMOTE_PROC_TRANSACTIONS';
REMOTE_SERVICE_NAME:                   'REMOTE_SERVICE_NAME';
REMOVE:                                'REMOVE';
REORGANIZE:                            'REORGANIZE';
REPAIR_ALLOW_DATA_LOSS:                'REPAIR_ALLOW_DATA_LOSS';
REPAIR_FAST:                           'REPAIR_FAST';
REPAIR_REBUILD:                        'REPAIR_REBUILD';
REPEATABLE:                            'REPEATABLE';
REPEATABLEREAD:                        'REPEATABLEREAD';
REPLACE:                               'REPLACE';
REPLICA:                               'REPLICA';
REPLICATE:                             'REPLICATE';
REQUEST_MAX_CPU_TIME_SEC:              'REQUEST_MAX_CPU_TIME_SEC';
REQUEST_MAX_MEMORY_GRANT_PERCENT:      'REQUEST_MAX_MEMORY_GRANT_PERCENT';
REQUEST_MEMORY_GRANT_TIMEOUT_SEC:      'REQUEST_MEMORY_GRANT_TIMEOUT_SEC';
REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT: 'REQUIRED_SYNCHRONIZED_SECONDARIES_TO_COMMIT';
RESAMPLE:                              'RESAMPLE';
RESERVE_DISK_SPACE:                    'RESERVE_DISK_SPACE';
RESOURCE:                              'RESOURCE';
RESOURCE_MANAGER_LOCATION:             'RESOURCE_MANAGER_LOCATION';
RESTRICTED_USER:                       'RESTRICTED_USER';
RESUMABLE:                             'RESUMABLE';
RETENTION:                             'RETENTION';
REVERSE:                               'REVERSE';
ROBUST:                                'ROBUST';
ROOT:                                  'ROOT';
ROUTE:                                 'ROUTE';
ROW:                                   'ROW';
ROW_NUMBER:                            'ROW_NUMBER';
ROWGUID:                               'ROWGUID';
ROWLOCK:                               'ROWLOCK';
ROWS:                                  'ROWS';
RTRIM:                                 'RTRIM';
SAMPLE:                                'SAMPLE';
SCHEMA_ID:                             'SCHEMA_ID';
SCHEMA_NAME:                           'SCHEMA_NAME';
SCHEMABINDING:                         'SCHEMABINDING';
SCOPE_IDENTITY:                        'SCOPE_IDENTITY';
SCOPED:                                'SCOPED';
SCROLL:                                'SCROLL';
SCROLL_LOCKS:                          'SCROLL_LOCKS';
SEARCH:                                'SEARCH';
SECONDARY:                             'SECONDARY';
SECONDARY_ONLY:                        'SECONDARY_ONLY';
SECONDARY_ROLE:                        'SECONDARY_ROLE';
SECONDS:                               'SECONDS';
SECRET:                                'SECRET';
SECURABLES:                            'SECURABLES';
SECURITY:                              'SECURITY';
SECURITY_LOG:                          'SECURITY_LOG';
SEEDING_MODE:                          'SEEDING_MODE';
SELF:                                  'SELF';
SEMI_SENSITIVE:                        'SEMI_SENSITIVE';
SEND:                                  'SEND';
SENT:                                  'SENT';
SEQUENCE:                              'SEQUENCE';
SEQUENCE_NUMBER:                       'SEQUENCE_NUMBER';
SERIALIZABLE:                          'SERIALIZABLE';
SERVERPROPERTY:                        'SERVERPROPERTY';
SERVICEBROKER:                         'SERVICEBROKER';
SESSIONPROPERTY:                       'SESSIONPROPERTY';
SESSION_TIMEOUT:                       'SESSION_TIMEOUT';
SETERROR:                              'SETERROR';
SHARE:                                 'SHARE';
SHARED:                                'SHARED';
SHOWCONTIG:                            'SHOWCONTIG';
SHOWPLAN:                              'SHOWPLAN';
SHOWPLAN_ALL:                          'SHOWPLAN_ALL';
SHOWPLAN_TEXT:                         'SHOWPLAN_TEXT';
SHOWPLAN_XML:                          'SHOWPLAN_XML';
SIGNATURE:                             'SIGNATURE';
SIMPLE:                                'SIMPLE';
SINGLE_USER:                           'SINGLE_USER';
SIZE:                                  'SIZE';
SMALLINT:                              'SMALLINT';
SNAPSHOT:                              'SNAPSHOT';
SORT_IN_TEMPDB:                        'SORT_IN_TEMPDB';
SOUNDEX:                               'SOUNDEX';
SPACE_KEYWORD:                         'SPACE';
SPARSE:                                'SPARSE';
SPATIAL_WINDOW_MAX_CELLS:              'SPATIAL_WINDOW_MAX_CELLS';
SQL_VARIANT_PROPERTY:                  'SQL_VARIANT_PROPERTY';
STANDBY:                               'STANDBY';
START_DATE:                            'START_DATE';
STATIC:                                'STATIC';
STATISTICS_INCREMENTAL:                'STATISTICS_INCREMENTAL';
STATISTICS_NORECOMPUTE:                'STATISTICS_NORECOMPUTE';
STATS_DATE:                            'STATS_DATE';
STATS_STREAM:                          'STATS_STREAM';
STATUS:                                'STATUS';
STATUSONLY:                            'STATUSONLY';
STDEV:                                 'STDEV';
STDEVP:                                'STDEVP';
STOPLIST:                              'STOPLIST';
STR:                                   'STR';
STRING_AGG:                            'STRING_AGG';
STRING_ESCAPE:                         'STRING_ESCAPE';
STUFF:                                 'STUFF';
SUBJECT:                               'SUBJECT';
SUBSCRIBE:                             'SUBSCRIBE';
SUBSCRIPTION:                          'SUBSCRIPTION';
SUBSTRING:                             'SUBSTRING';
SUM:                                   'SUM';
SUSPEND:                               'SUSPEND';
SUSER_ID:                              'SUSER_ID';
SUSER_NAME:                            'SUSER_NAME';
SUSER_SID:                             'SUSER_SID';
SUSER_SNAME:                           'SUSER_SNAME';
SYMMETRIC:                             'SYMMETRIC';
SYNCHRONOUS_COMMIT:                    'SYNCHRONOUS_COMMIT';
SYNONYM:                               'SYNONYM';
SYSTEM:                                'SYSTEM';
TABLERESULTS:                          'TABLERESULTS';
TABLOCK:                               'TABLOCK';
TABLOCKX:                              'TABLOCKX';
TAKE:                                  'TAKE';
TARGET_RECOVERY_TIME:                  'TARGET_RECOVERY_TIME';
TB:                                    'TB';
TEXTIMAGE_ON:                          'TEXTIMAGE_ON';
THROW:                                 'THROW';
TIES:                                  'TIES';
TIME:                                  'TIME';
TIMEOUT:                               'TIMEOUT';
TIMER:                                 'TIMER';
TINYINT:                               'TINYINT';
TORN_PAGE_DETECTION:                   'TORN_PAGE_DETECTION';
TRACKING:                              'TRACKING';
TRANSACTION_ID:                        'TRANSACTION_ID';
TRANSFORM_NOISE_WORDS:                 'TRANSFORM_NOISE_WORDS';
TRANSLATE:                             'TRANSLATE';
TRIM:                                  'TRIM';
TRIPLE_DES:                            'TRIPLE_DES';
TRIPLE_DES_3KEY:                       'TRIPLE_DES_3KEY';
TRUSTWORTHY:                           'TRUSTWORTHY';
TRY:                                   'TRY';
TSQL:                                  'TSQL';
TWO_DIGIT_YEAR_CUTOFF:                 'TWO_DIGIT_YEAR_CUTOFF';
TYPE:                                  'TYPE';
TYPE_ID:                               'TYPE_ID';
TYPE_NAME:                             'TYPE_NAME';
TYPE_WARNING:                          'TYPE_WARNING';
TYPEPROPERTY:                          'TYPEPROPERTY';
UNBOUNDED:                             'UNBOUNDED';
UNCOMMITTED:                           'UNCOMMITTED';
UNICODE:                               'UNICODE';
UNKNOWN:                               'UNKNOWN';
UNLIMITED:                             'UNLIMITED';
UNMASK:                                'UNMASK';
UOW:                                   'UOW';
UPDLOCK:                               'UPDLOCK';
UPPER:                                 'UPPER';
USER_ID:                               'USER_ID';
USER_NAME:                             'USER_NAME';
USING:                                 'USING';
VALID_XML:                             'VALID_XML';
VALIDATION:                            'VALIDATION';
VALUE:                                 'VALUE';
VALUE_SQUARE_BRACKET:                  '[VALUE]';
VAR:                                   'VAR';
VARBINARY_KEYWORD:                     'VARBINARY';
VARP:                                  'VARP';
VERIFY_CLONEDB:                        'VERIFY_CLONEDB';
VERSION:                               'VERSION';
VIEW_METADATA:                         'VIEW_METADATA';
VIEWS:                                 'VIEWS';
WAIT:                                  'WAIT';
WELL_FORMED_XML:                       'WELL_FORMED_XML';
WITHOUT_ARRAY_WRAPPER:                 'WITHOUT_ARRAY_WRAPPER';
WORK:                                  'WORK';
WORKLOAD:                              'WORKLOAD';
XLOCK:                                 'XLOCK';
XML:                                   'XML';
XML_COMPRESSION:                       'XML_COMPRESSION';
XMLDATA:                               'XMLDATA';
XMLNAMESPACES:                         'XMLNAMESPACES';
XMLSCHEMA:                             'XMLSCHEMA';
XSINIL:                                'XSINIL';
ZONE:                                  'ZONE';
//More keywords that can also be used as IDs
ABORT_AFTER_WAIT:                      'ABORT_AFTER_WAIT';
ABSENT:                                'ABSENT';
ADMINISTER:                            'ADMINISTER';
AES:                                   'AES';
ALLOW_CONNECTIONS:                     'ALLOW_CONNECTIONS';
ALLOW_MULTIPLE_EVENT_LOSS:             'ALLOW_MULTIPLE_EVENT_LOSS';
ALLOW_SINGLE_EVENT_LOSS:               'ALLOW_SINGLE_EVENT_LOSS';
ANONYMOUS:                             'ANONYMOUS';
APPEND:                                'APPEND';
APPLICATION:                           'APPLICATION';
ASYMMETRIC:                            'ASYMMETRIC';
ASYNCHRONOUS_COMMIT:                   'ASYNCHRONOUS_COMMIT';
AUTHENTICATE:                          'AUTHENTICATE';
AUTHENTICATION:                        'AUTHENTICATION';
AUTOMATED_BACKUP_PREFERENCE:           'AUTOMATED_BACKUP_PREFERENCE';
AUTOMATIC:                             'AUTOMATIC';
AVAILABILITY_MODE:                     'AVAILABILITY_MODE';
BEFORE:                                'BEFORE';
BLOCK:                                 'BLOCK';
BLOCKERS:                              'BLOCKERS';
BLOCKSIZE:                             'BLOCKSIZE';
BLOCKING_HIERARCHY:                    'BLOCKING_HIERARCHY';
BUFFER:                                'BUFFER';
BUFFERCOUNT:                           'BUFFERCOUNT';
CACHE:                                 'CACHE';
CALLED:                                'CALLED';
CERTIFICATE:                           'CERTIFICATE';
CHANGETABLE:                           'CHANGETABLE';
CHANGES:                               'CHANGES';
CHECK_POLICY:                          'CHECK_POLICY';
CHECK_EXPIRATION:                      'CHECK_EXPIRATION';
CLASSIFIER_FUNCTION:                   'CLASSIFIER_FUNCTION';
CLUSTER:                               'CLUSTER';
COMPRESS:                              'COMPRESS';
COMPRESSION:                           'COMPRESSION';
CONNECT:                               'CONNECT';
CONNECTION:                            'CONNECTION';
CONFIGURATION:                         'CONFIGURATION';
CONNECTIONPROPERTY:                    'CONNECTIONPROPERTY';
CONTAINMENT:                           'CONTAINMENT';
CONTEXT:                               'CONTEXT';
CONTEXT_INFO:                          'CONTEXT_INFO';
CONTINUE_AFTER_ERROR:                  'CONTINUE_AFTER_ERROR';
CONTRACT:                              'CONTRACT';
CONTRACT_NAME:                         'CONTRACT_NAME';
CONVERSATION:                          'CONVERSATION';
COPY_ONLY:                             'COPY_ONLY';
CURRENT_REQUEST_ID:                    'CURRENT_REQUEST_ID';
CURRENT_TRANSACTION_ID:                'CURRENT_TRANSACTION_ID';
CYCLE:                                 'CYCLE';
DATA_COMPRESSION:                      'DATA_COMPRESSION';
DATA_SOURCE:                           'DATA_SOURCE';
DATABASE_MIRRORING:                    'DATABASE_MIRRORING';
DATASPACE:                             'DATASPACE';
DDL:                                   'DDL';
DECOMPRESS:                            'DECOMPRESS';
DEFAULT_DATABASE:                      'DEFAULT_DATABASE';
DEFAULT_SCHEMA:                        'DEFAULT_SCHEMA';
DIAGNOSTICS:                           'DIAGNOSTICS';
DIFFERENTIAL:                          'DIFFERENTIAL';
DISTRIBUTION:                          'DISTRIBUTION';
DTC_SUPPORT:                           'DTC_SUPPORT';
ENABLED:                               'ENABLED';
ENDPOINT:                              'ENDPOINT';
ERROR:                                 'ERROR';
ERROR_LINE:                            'ERROR_LINE';
ERROR_MESSAGE:                         'ERROR_MESSAGE';
ERROR_NUMBER:                          'ERROR_NUMBER';
ERROR_PROCEDURE:                       'ERROR_PROCEDURE';
ERROR_SEVERITY:                        'ERROR_SEVERITY';
ERROR_STATE:                           'ERROR_STATE';
EVENT:                                 'EVENT';
EVENTDATA:                             'EVENTDATA';
EVENT_RETENTION_MODE:                  'EVENT_RETENTION_MODE';
EXECUTABLE_FILE:                       'EXECUTABLE_FILE';
EXPIREDATE:                            'EXPIREDATE';
EXTENSION:                             'EXTENSION';
EXTERNAL_ACCESS:                       'EXTERNAL_ACCESS';
FAILOVER:                              'FAILOVER';
FAILURECONDITIONLEVEL:                 'FAILURECONDITIONLEVEL';
FAN_IN:                                'FAN_IN';
FILE_SNAPSHOT:                         'FILE_SNAPSHOT';
FORCESEEK:                             'FORCESEEK';
FORCE_SERVICE_ALLOW_DATA_LOSS:         'FORCE_SERVICE_ALLOW_DATA_LOSS';
FORMATMESSAGE:                         'FORMATMESSAGE';
GET:                                   'GET';
GET_FILESTREAM_TRANSACTION_CONTEXT:    'GET_FILESTREAM_TRANSACTION_CONTEXT';
GETANCESTOR:                           'GETANCESTOR';
GETANSINULL:                           'GETANSINULL';
GETDESCENDANT:                         'GETDESCENDANT';
GETLEVEL:                              'GETLEVEL';
GETREPARENTEDVALUE:                    'GETREPARENTEDVALUE';
GETROOT:                               'GETROOT';
GOVERNOR:                              'GOVERNOR';
HASHED:                                'HASHED';
HEALTHCHECKTIMEOUT:                    'HEALTHCHECKTIMEOUT';
HEAP:                                  'HEAP';
HIERARCHYID:                           'HIERARCHYID';
HOST_ID:                               'HOST_ID';
HOST_NAME:                             'HOST_NAME';
IIF:                                   'IIF';
IO:                                    'IO';
INCLUDE:                               'INCLUDE';
INCREMENT:                             'INCREMENT';
INFINITE:                              'INFINITE';
INIT:                                  'INIT';
INSTEAD:                               'INSTEAD';
ISDESCENDANTOF:                        'ISDESCENDANTOF';
ISNULL:                                'ISNULL';
ISNUMERIC:                             'ISNUMERIC';
KERBEROS:                              'KERBEROS';
KEY_PATH:                              'KEY_PATH';
KEY_STORE_PROVIDER_NAME:               'KEY_STORE_PROVIDER_NAME';
LANGUAGE:                              'LANGUAGE';
LIBRARY:                               'LIBRARY';
LIFETIME:                              'LIFETIME';
LINKED:                                'LINKED';
LINUX:                                 'LINUX';
LISTENER_IP:                           'LISTENER_IP';
LISTENER_PORT:                         'LISTENER_PORT';
LOCAL_SERVICE_NAME:                    'LOCAL_SERVICE_NAME';
LOG:                                   'LOG';
MASK:                                  'MASK';
MATCHED:                               'MATCHED';
MASTER:                                'MASTER';
MAX_MEMORY:                            'MAX_MEMORY';
MAXTRANSFER:                           'MAXTRANSFER';
MAXVALUE:                              'MAXVALUE';
MAX_DISPATCH_LATENCY:                  'MAX_DISPATCH_LATENCY';
MAX_DURATION:                          'MAX_DURATION';
MAX_EVENT_SIZE:                        'MAX_EVENT_SIZE';
MAX_SIZE:                              'MAX_SIZE';
MAX_OUTSTANDING_IO_PER_VOLUME:         'MAX_OUTSTANDING_IO_PER_VOLUME';
MEDIADESCRIPTION:                      'MEDIADESCRIPTION';
MEDIANAME:                             'MEDIANAME';
MEMBER:                                'MEMBER';
MEMORY_PARTITION_MODE:                 'MEMORY_PARTITION_MODE';
MESSAGE_FORWARDING:                    'MESSAGE_FORWARDING';
MESSAGE_FORWARD_SIZE:                  'MESSAGE_FORWARD_SIZE';
MINVALUE:                              'MINVALUE';
MIRROR:                                'MIRROR';
MUST_CHANGE:                           'MUST_CHANGE';
NEWID:                                 'NEWID';
NEWSEQUENTIALID:                       'NEWSEQUENTIALID';
NOFORMAT:                              'NOFORMAT';
NOINIT:                                'NOINIT';
NONE:                                  'NONE';
NOREWIND:                              'NOREWIND';
NOSKIP:                                'NOSKIP';
NOUNLOAD:                              'NOUNLOAD';
NO_CHECKSUM:                           'NO_CHECKSUM';
NO_COMPRESSION:                        'NO_COMPRESSION';
NO_EVENT_LOSS:                         'NO_EVENT_LOSS';
NOTIFICATION:                          'NOTIFICATION';
NTLM:                                  'NTLM';
OLD_PASSWORD:                          'OLD_PASSWORD';
ON_FAILURE:                            'ON_FAILURE';
OPERATIONS:                            'OPERATIONS';
PAGE:                                  'PAGE';
PARAM_NODE:                            'PARAM_NODE';
PARTIAL:                               'PARTIAL';
PASSWORD:                              'PASSWORD';
PERMISSION_SET:                        'PERMISSION_SET';
PER_CPU:                               'PER_CPU';
PER_DB:                                'PER_DB';
PER_NODE:                              'PER_NODE';
PERSISTED:                             'PERSISTED';
PLATFORM:                              'PLATFORM';
POLICY:                                'POLICY';
PREDICATE:                             'PREDICATE';
PROCESS:                               'PROCESS';
PROFILE:                               'PROFILE';
PYTHON:                                'PYTHON';
R:                                     'R';
READ_WRITE_FILEGROUPS:                 'READ_WRITE_FILEGROUPS';
REGENERATE:                            'REGENERATE';
RELATED_CONVERSATION:                  'RELATED_CONVERSATION';
RELATED_CONVERSATION_GROUP:            'RELATED_CONVERSATION_GROUP';
REQUIRED:                              'REQUIRED';
RESET:                                 'RESET';
RESOURCES:                             'RESOURCES';
RESTART:                               'RESTART';
RESUME:                                'RESUME';
RETAINDAYS:                            'RETAINDAYS';
RETURNS:                               'RETURNS';
REWIND:                                'REWIND';
ROLE:                                  'ROLE';
ROUND_ROBIN:                           'ROUND_ROBIN';
ROWCOUNT_BIG:                          'ROWCOUNT_BIG';
RSA_512:                               'RSA_512';
RSA_1024:                              'RSA_1024';
RSA_2048:                              'RSA_2048';
RSA_3072:                              'RSA_3072';
RSA_4096:                              'RSA_4096';
SAFETY:                                'SAFETY';
SAFE:                                  'SAFE';
SCHEDULER:                             'SCHEDULER';
SCHEME:                                'SCHEME';
SCRIPT:                                'SCRIPT';
SERVER:                                'SERVER';
SERVICE:                               'SERVICE';
SERVICE_BROKER:                        'SERVICE_BROKER';
SERVICE_NAME:                          'SERVICE_NAME';
SESSION:                               'SESSION';
SESSION_CONTEXT:                       'SESSION_CONTEXT';
SETTINGS:                              'SETTINGS';
SHRINKLOG:                             'SHRINKLOG';
SID:                                   'SID';
SKIP_KEYWORD:                          'SKIP';
SOFTNUMA:                              'SOFTNUMA';
SOURCE:                                'SOURCE';
SPECIFICATION:                         'SPECIFICATION';
SPLIT:                                 'SPLIT';
SQL:                                   'SQL';
SQLDUMPERFLAGS:                        'SQLDUMPERFLAGS';
SQLDUMPERPATH:                         'SQLDUMPERPATH';
SQLDUMPERTIMEOUT:                      'SQLDUMPERTIMEOUT';
STATE:                                 'STATE';
STATS:                                 'STATS';
START:                                 'START';
STARTED:                               'STARTED';
STARTUP_STATE:                         'STARTUP_STATE';
STOP:                                  'STOP';
STOPPED:                               'STOPPED';
STOP_ON_ERROR:                         'STOP_ON_ERROR';
SUPPORTED:                             'SUPPORTED';
SWITCH:                                'SWITCH';
TAPE:                                  'TAPE';
TARGET:                                'TARGET';
TCP:                                   'TCP';
TOSTRING:                              'TOSTRING';
TRACE:                                 'TRACE';
TRACK_CAUSALITY:                       'TRACK_CAUSALITY';
TRANSFER:                              'TRANSFER';
UNCHECKED:                             'UNCHECKED';
UNLOCK:                                'UNLOCK';
UNSAFE:                                'UNSAFE';
URL:                                   'URL';
USED:                                  'USED';
VERBOSELOGGING:                        'VERBOSELOGGING';
VISIBILITY:                            'VISIBILITY';
WAIT_AT_LOW_PRIORITY:                  'WAIT_AT_LOW_PRIORITY';
WINDOWS:                               'WINDOWS';
WITHOUT:                               'WITHOUT';
WITNESS:                               'WITNESS';
XACT_ABORT:                            'XACT_ABORT';
XACT_STATE:                            'XACT_STATE';

ABS:                                   'ABS';
ACOS:                                  'ACOS';
ASIN:                                  'ASIN';
ATAN:                                  'ATAN';
ATN2:                                  'ATN2';
CEILING:                               'CEILING';
COS:                                   'COS';
COT:                                   'COT';
DEGREES:                               'DEGREES';
EXP:                                   'EXP';
FLOOR:                                 'FLOOR';
LOG10:                                 'LOG10';
PI:                                    'PI';
POWER:                                 'POWER';
RADIANS:                               'RADIANS';
RAND:                                  'RAND';
ROUND:                                 'ROUND';
SIGN:                                  'SIGN';
SIN:                                   'SIN';
SQRT:                                  'SQRT';
SQUARE:                                'SQUARE';
TAN:                                   'TAN';

CURRENT_TIMEZONE:                      'CURRENT_TIMEZONE';
CURRENT_TIMEZONE_ID:                   'CURRENT_TIMEZONE_ID';
DATE_BUCKET:                           'DATE_BUCKET';
DATEDIFF_BIG:                          'DATEDIFF_BIG';
DATEFROMPARTS:                         'DATEFROMPARTS';
DATETIME2FROMPARTS:                    'DATETIME2FROMPARTS';
DATETIMEFROMPARTS:                     'DATETIMEFROMPARTS';
DATETIMEOFFSETFROMPARTS:               'DATETIMEOFFSETFROMPARTS';
DATETRUNC:                             'DATETRUNC';
DAY:                                   'DAY';
EOMONTH:                               'EOMONTH';
ISDATE:                                'ISDATE';
MONTH:                                 'MONTH';
SMALLDATETIMEFROMPARTS:                'SMALLDATETIMEFROMPARTS';
SWITCHOFFSET:                          'SWITCHOFFSET';
SYSDATETIME:                           'SYSDATETIME';
SYSDATETIMEOFFSET:                     'SYSDATETIMEOFFSET';
SYSUTCDATETIME:                        'SYSUTCDATETIME';
TIMEFROMPARTS:                         'TIMEFROMPARTS';
TODATETIMEOFFSET:                      'TODATETIMEOFFSET';
YEAR:                                  'YEAR';

QUARTER:                               'QUARTER';
DAYOFYEAR:                             'DAYOFYEAR';
WEEK:                                  'WEEK';
HOUR:                                  'HOUR';
MINUTE:                                'MINUTE';
SECOND:                                'SECOND';
MILLISECOND:                           'MILLISECOND';
MICROSECOND:                           'MICROSECOND';
NANOSECOND:                            'NANOSECOND';
TZOFFSET:                              'TZOFFSET';
ISO_WEEK:                              'ISO_WEEK';
WEEKDAY:                               'WEEKDAY';

YEAR_ABBR:                             'yy' | 'yyyy';
QUARTER_ABBR:                          'qq' | 'q';
MONTH_ABBR:                            'mm' | 'm';
DAYOFYEAR_ABBR:                        'dy' | 'y';
DAY_ABBR:                              'dd' | 'd';
WEEK_ABBR:                             'wk' | 'ww';
HOUR_ABBR:                             'hh';
MINUTE_ABBR:                           'mi' | 'n';
SECOND_ABBR:                           'ss' | 's';
MILLISECOND_ABBR:                      'ms';
MICROSECOND_ABBR:                      'mcs';
NANOSECOND_ABBR:                       'ns';
TZOFFSET_ABBR:                         'tz';
ISO_WEEK_ABBR:                         'isowk' | 'isoww';
WEEKDAY_ABBR:                          'dw';

SP_EXECUTESQL:                         'SP_EXECUTESQL';

//Build-ins:
VARCHAR:                               'VARCHAR';
NVARCHAR:                              'NVARCHAR';

//Combinations that cannot be used as IDs
DISK_DRIVE:                            [A-Z][:];
DOLLAR_ACTION:                         '$ACTION';

// Functions starting with double at signs
// https://learn.microsoft.com/en-us/sql/t-sql/language-elements/variables-transact-sql?view=sql-server-ver16
CURSOR_ROWS:                           '@@CURSOR_ROWS';
FETCH_STATUS:                          '@@FETCH_STATUS';

SPACE:              [ \t\r\n]+    -> skip;
// https://docs.microsoft.com/en-us/sql/t-sql/language-elements/slash-star-comment-transact-sql
COMMENT:            '/*' (COMMENT | .)*? '*/' -> channel(HIDDEN);
LINE_COMMENT:       '--' ~[\r\n]* -> channel(HIDDEN);

// TODO: ID can be not only Latin.
DOUBLE_QUOTE_ID:    '"' ~'"'+ '"';
DOUBLE_QUOTE_BLANK: '""';
SINGLE_QUOTE:       '\'';
SQUARE_BRACKET_ID:  '[' (~']' | ']' ']')* ']';
LOCAL_ID:           '@' ([A-Z_$@#0-9] | FullWidthLetter)*;
TEMP_ID:            '#' ([A-Z_$@#0-9] | FullWidthLetter)*;
DECIMAL:             DEC_DIGIT+;
ID:                  ( [A-Z_#] | FullWidthLetter) ( [A-Z_#$@0-9] | FullWidthLetter )*;
STRING /*options { caseInsensitive=false; }*/ : 'N'? '\'' (~'\'' | '\'\'')* '\'';
BINARY:              '0' 'X' HEX_DIGIT*;
FLOAT:               DEC_DOT_DEC;
REAL:                (DECIMAL | DEC_DOT_DEC) ('E' [+-]? DEC_DIGIT+);

EQUAL:               '=';

GREATER:             '>';
LESS:                '<';
EXCLAMATION:         '!';

PLUS_ASSIGN:         '+=';
MINUS_ASSIGN:        '-=';
MULT_ASSIGN:         '*=';
DIV_ASSIGN:          '/=';
MOD_ASSIGN:          '%=';
AND_ASSIGN:          '&=';
XOR_ASSIGN:          '^=';
OR_ASSIGN:           '|=';

DOUBLE_BAR:          '||';
DOT:                 '.';
UNDERLINE:           '_';
AT:                  '@';
SHARP:               '#';
DOLLAR:              '$';
LR_BRACKET:          '(';
RR_BRACKET:          ')';
COMMA:               ',';
SEMI:                ';';
COLON:               ':';
DOUBLE_COLON:        '::';
STAR:                '*';
DIVIDE:              '/';
MODULE:              '%';
PLUS:                '+';
MINUS:               '-';
BIT_NOT:             '~';
BIT_OR:              '|';
BIT_AND:             '&';
BIT_XOR:             '^';

PLACEHOLDER:         '?';

fragment LETTER:       [A-Z_];
fragment DEC_DOT_DEC:  (DEC_DIGIT+ '.' DEC_DIGIT+ |  DEC_DIGIT+ '.' | '.' DEC_DIGIT+);
fragment HEX_DIGIT:    [0-9A-F];
fragment DEC_DIGIT:    [0-9];


fragment FullWidthLetter /*options { caseInsensitive=false; }*/
    : '\u00c0'..'\u00d6'
    | '\u00d8'..'\u00f6'
    | '\u00f8'..'\u00ff'
    | '\u0100'..'\u1fff'
    | '\u2c00'..'\u2fff'
    | '\u3040'..'\u318f'
    | '\u3300'..'\u337f'
    | '\u3400'..'\u3fff'
    | '\u4e00'..'\u9fff'
    | '\ua000'..'\ud7ff'
    | '\uf900'..'\ufaff'
    | '\uff00'..'\ufff0'
    // | '\u10000'..'\u1F9FF'  //not support four bytes chars
    // | '\u20000'..'\u2FA1F'
    ;
