@dbml/core 5.3.1 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,157 +1,263 @@
1
- # MSSQL model structure generator
2
-
3
- This folder houses the implementation of the MSSQL model structure generator based on the ANTLR4 parser.
4
-
5
- This file documents the current features and bugs of this model structure generator.
6
-
7
- In the below table, the following notation is used:
8
- - ✅: Supported.
9
- - 🤷🏼‍♂️: Invalid SQL in MSSQL.
10
- - ❓: Valid SQL in MSSQL, the generator can still generate output but it ignores this syntax.
11
- - ❌: Valid SQL in MSSQL, but the generator fails to generate any output.
12
-
13
- | SQL syntax | MSSQL |
14
- |-------------------------------|---------------|
15
- | 1. INSERT statement | |
16
- | 1.a. Basic INSERT ... VALUES | |
17
- | 1.b. INSERT ... SELECT | ❌ |
18
- | 1.c. Multi-row INSERT | ✅ |
19
- | 1.d. Common table expression (WITH clause) | ❌ |
20
- | 1.e. Target table alias | 🤷🏼‍♂️ |
21
- | 1.f. INSERT OUTPUT | ❓ (ignore the OUTPUT clause) |
22
- | 1.g. INSERT ... ON CONFLICT (UPSERT)/INSERT ... ON DUPLICATE KEY/INSERT … IGNORE | 🤷🏼‍♂️ |
23
- | 1.h. INSERT OVERWRITE | 🤷🏼‍♂️ |
24
- | 1.i. Multi-table INSERT | ❌ |
25
- | 1.j. Conditional multi-table INSERT (WHEN/FIRST/ALL) | ❌ |
26
- | 6. CREATE TABLE | |
27
- | 6.a. Basic syntax | ✅ |
28
- | 6.a.i. Enumerated data type | 🤷🏼‍♂️ |
29
- | 6.a.ii. Data type of the form name(...) | ✅ |
30
- | 6.a.iii. Data type of the form name\[...\] | 🤷🏼‍♂️ |
31
- | 6.b. PRIMARY KEY | |
32
- | 6.b.i. Inline PRIMARY KEY | ✅ |
33
- | 6.b.ii. Out-of-line PRIMARY KEY | ✅ |
34
- | 6.b.iii. Composite PRIMARY KEY | ✅ |
35
- | 6.b.iv. Named PRIMARY KEY | ✅ |
36
- | 6.b.v. Other options (deferrable, etc.) | ❓ (ignore the options) |
37
- | 6.c. FOREIGN KEY | |
38
- | 6.c.i. Inline FOREIGN KEY | ❌ (bug) |
39
- | 6.c.ii. Out-of-line FOREIGN KEY | (bug) |
40
- | 6.c.iii. Composite FOREIGN KEY | ❌ (bug) |
41
- | 6.c.iv. Named FOREIGN KEY | ❌ (bug) |
42
- | 6.c.v. ON UPDATE | ❌ (bug) |
43
- | 6.c.vi. ON DELETE | ❌ (bug) |
44
- | 6.c.vii. Other options (deferrable, etc.) | ❌ (bug) |
45
- | 6.d. UNIQUE | |
46
- | 6.d.i. Inline UNIQUE | ✅ |
47
- | 6.d.ii. Out-of-line UNIQUE | |
48
- | 6.d.iii. Composite UNIQUE | ✅ |
49
- | 6.d.iv. Named UNIQUE | (ignore the name) |
50
- | 6.d.v. Other options (deferrable, etc) | (ignore the option) |
51
- | 6.d.vi. NULLS NOT DISTINCT | 🤷🏼‍♂️ |
52
- | 6.d.vii. UNIQUE KEY/UNIQUE INDEX | 🤷🏼‍♂️ |
53
- | 6.e. CHECK | |
54
- | 6.e.i. Inline CHECK | (parse fail) |
55
- | 6.e.ii. Out-of-line CHECK | (parse fail) |
56
- | 6.e.iii. Named CHECK | ❌ (parse fail) |
57
- | 6.e.iv. Other options (enforcement control, etc.) | ❌ (parse fail) |
58
- | 6.f. DEFAULT values | |
59
- | 6.f.i. Inline DEFAULT | ✅ |
60
- | 6.f.ii. Out-of-line DEFAULT | ❌ (Totally ignore) |
61
- | 6.f.iii. Functional DEFAULT | |
62
- | 6.f.iv. Named DEFAULT | ❓ (ignore the name) |
63
- | 6.g. NULL | |
64
- | 6.h. NOT NULL | |
65
- | 6.h.i. Inline NOT NULL | |
66
- | 6.h.ii. Out-of-line NOT NULL | 🤷🏼‍♂️ |
67
- | 6.h.iii. Named NOT NULL | 🤷🏼‍♂️ |
68
- | 6.h.iv. Other options (deferrable, etc.) | (Ignore) |
69
- | 6.i. Indexes | |
70
- | 6.i.i. Inline indexes | 🤷🏼‍♂️ (except for UNIQUE/PRIMARY KEY) |
71
- | 6.i.ii. Out-of-line indexes | 🤷🏼‍♂️ (except for UNIQUE/PRIMARY KEY) |
72
- | 6.i.iii. Named indexes | 🤷🏼‍♂️ |
73
- | 6.i.iv. Multi-column indexes | 🤷🏼‍♂️ |
74
- | 6.i.v. CLUSTERED/NONCLUSTERED | (ignore) |
75
- | 6.i.vi. FULLTEXT | 🤷🏼‍♂️ |
76
- | 6.i.vii. SPATIAL | 🤷🏼‍♂️ |
77
- | 6.i.viii. Other options | 🤷🏼‍♂️ |
78
- | 6.i.ix. USING HASH/BTREE | 🤷🏼‍♂️ |
79
- | 6.j. Auto-increment | |
80
- | 6.j.i. AUTO_INCREMENT | 🤷🏼‍♂️ |
81
- | 6.j.ii. SERIAL/BIG SERIAL | 🤷🏼‍♂️ |
82
- | 6.j.iii. IDENTITY | ✅ |
83
- | 6.j.iv. Increment range | ✅ |
84
- | 6.j.v. GENERATED ... AS IDENTITY | (parse fail) |
85
- | 6.k. Computed column | ❓ |
86
- | 6.l. TEMPORARY tables | (indication of temporary table via # prefix) |
87
- | 6.m. CREATE TABLE AS SELECT (CTAS) | ❌ |
88
- | 6.n. Comments | |
89
- | 6.n.i. Table comments | 🤷🏼‍♂️ |
90
- | 6.n.ii. Column comments | 🤷🏼‍♂️ |
91
- | 6.o. Other options (inheritance, UNLOGGED, partition, collate, etc.) | |
92
- | 7. ALTER TABLE | |
93
- | 7.a. ADD COLUMN | |
94
- | 7.a.i. Type | ❌ |
95
- | 7.a.ii. DEFAULT | ❌ |
96
- | 7.a.iii. NOT NULL | ❌ |
97
- | 7.a.iv. NULL | |
98
- | 7.a.v. CHECK | ❌ |
99
- | 7.a.vi. UNIQUE | |
100
- | 7.a.vii. FOREIGN KEY | (parse fail) |
101
- | 7.a.viii. PRIMARY KEY | |
102
- | 7.a.ix. AUTOINCREMENT/SERIAL/BIGSERIAL/IDENTITY/GENERATED AS IDENTITY | |
103
- | 7.a.x. Computed column | ❌ |
104
- | 7.b. DROP COLUMN | ❌ |
105
- | 7.c. ALTER COLUMN / MODIFY COLUMN | |
106
- | 7.c.i. COMMENT | 🤷🏼‍♂️ |
107
- | 7.c.ii. Others | ❌ |
108
- | 7.d. RENAME COLUMN | |
109
- | 7.e. ADD CONSTRAINT | |
110
- | 7.e.i. DEFAULT | (ignore name) |
111
- | 7.e.ii. NOT NULL | |
112
- | 7.e.iii. NULL | ❌ |
113
- | 7.e.iv. named CHECK | ✅ |
114
- | 7.e.v. unnamed CHECK | ✅ |
115
- | 7.e.vi. named UNIQUE | |
116
- | 7.e.vii. unnamed UNIQUE | ✅ |
117
- | 7.e.viii. named PRIMARY KEY | |
118
- | 7.e.ix. unnamed PRIMARY KEY | |
119
- | 7.e.x. named FOREIGN KEY | |
120
- | 7.e.xi. unnamed FOREIGN KEY | |
121
- | 7.g. DROP CONSTRAINT | ❌ |
122
- | 7.h. ALTER CONSTRAINT | ❌ |
123
- | 7.i. RENAME TABLE | ❌ |
124
- | 7.j. SET SCHEMA | |
125
- | 7.k. ALTER INDEX | ❌ |
126
- | 7.l. DROP INDEX | |
127
- | 7.m. SET COMMENT/COMMENT = | 🤷🏼‍♂️ |
128
- | 7.n. ADD INDEX | |
129
- | 8. DROP TABLE | |
130
- | 8.a. Basic syntax | |
131
- | 9. CREATE INDEX | |
132
- | 9.a. Basic syntax | ✅ |
133
- | 9.b. Composite index | ✅ |
134
- | 9.c. Named index | ✅ |
135
- | 9.d. UNIQUE index | |
136
- | 9.e. Partial/Filtered index | ❓ (ignore) |
137
- | 9.f. BTREE/HASH/GIST/BRIN/… index | (parse fail) |
138
- | 9.g. INCLUDE columns | (ignore) |
139
- | 9.h. CLUSTERED/NONCLUSTERED | (ignore) |
140
- | 9.i. Functional index | 🤷🏼‍♂️ (However, the MSSQL exporter is currently exporting this syntax) |
141
- | 9.j. FULLTEXT/SPATIAL index | (parse fail) |
142
- | 9.k. COLLATE | 🤷🏼‍♂️ |
143
- | 9.l. COMMENT | 🤷🏼‍♂️ |
144
- | 9.m. NULLS LAST/FIRST | 🤷🏼‍♂️ |
145
- | 9.n. ASC/DESC | ❓ (ignore) |
146
- | 10. DROP INDEX | |
147
- | 10.a. Basic syntax | ❌ |
148
- | 11. ALTER INDEX | |
149
- | 11.a. RENAME | |
150
- | 11.b. ALTER COLUMN | ❌ |
151
- | 12. CREATE VIEW | |
152
- | 12.a. Basic syntax | ❌ |
153
- | 13. Comment | |
154
- | 13.a. Table comments | ✅ (but unreliable) |
155
- | 13.b. Column comments | (but unreliable) |
156
- | 13.c. COMMENT … IS NULL | ✅ (but unreliable) |
157
- | 13.d. Index comments | |
1
+ # Microsoft SQL Server Parser Support
2
+
3
+ > Comprehensive documentation for the MSSQL (SQL Server) model structure generator based on the ANTLR4 parser.
4
+
5
+ ## Overview
6
+
7
+ This module provides SQL parsing capabilities for Microsoft SQL Server databases, enabling conversion of T-SQL DDL statements to DBML format. The parser supports SQL Server-specific syntax including `IDENTITY` columns with increment ranges, temporary tables via the `#` prefix convention, and comprehensive `ALTER TABLE ADD CONSTRAINT` operations. Note that there is a known issue with column-level `FOREIGN KEY` constraint parsing.
8
+
9
+ ## Support Legend
10
+
11
+ | Symbol | Meaning |
12
+ |--------|---------|
13
+ | | Fully supported and correctly parsed |
14
+ | ◐ | Valid SQL that is parsed, but some options/clauses are ignored |
15
+ | | Valid T-SQL syntax, but the parser fails to generate output |
16
+ | | Syntax not valid in SQL Server |
17
+
18
+ ## Key Capabilities
19
+
20
+ - **Data Definition**
21
+ - `CREATE TABLE` with full syntax support
22
+ - Data types: parameterized types (e.g., `VARCHAR(255)`, `DECIMAL(10,2)`)
23
+ - Temporary tables via `#` prefix (e.g., `#temp_table`)
24
+ - **Constraints**
25
+ - `PRIMARY KEY` (column-level, table-level, multi-column, with explicit name)
26
+ - `FOREIGN KEY` (table-level supported; column-level has a bug)
27
+ - `UNIQUE`, `CHECK`, `DEFAULT`, `NOT NULL`
28
+ - **Auto-increment**
29
+ - `IDENTITY` with seed and increment (e.g., `IDENTITY(1,1)`)
30
+ - **Indexes**
31
+ - `CREATE INDEX` (basic, multi-column, unique)
32
+ - CLUSTERED / NONCLUSTERED (parsed but ignored)
33
+ - **Comments**
34
+ - `sp_addextendedproperty` (unreliable parsing)
35
+ - **Schema Modification**
36
+ - `ALTER TABLE ADD CONSTRAINT`
37
+ - Supports: `DEFAULT`, `CHECK`, `UNIQUE`, `PRIMARY KEY`, `FOREIGN KEY`
38
+ - **Data Manipulation**
39
+ - Basic `INSERT` and multi-row `INSERT`
40
+
41
+ ---
42
+
43
+ ## Feature Support Matrix
44
+
45
+ ### `CREATE TABLE`
46
+
47
+ | Feature | Status | Notes |
48
+ |---------|---------|-------|
49
+ | Basic `CREATE TABLE` syntax | | |
50
+ | Enumerated data types | | SQL Server doesn't have ENUM type |
51
+ | Parameterized types `name(...)` | | e.g., `VARCHAR(255)`, `DECIMAL(10,2)` |
52
+ | Array types `name[...]` | | Not supported in SQL Server |
53
+ | TEMPORARY tables (`#` prefix) || Tables with `#` prefix recognized as temporary |
54
+ | `CREATE TABLE` AS SELECT (SELECT INTO) | ✗ | |
55
+ | Table options (FILEGROUP, etc.) | | Options are ignored |
56
+
57
+ ### Constraints
58
+
59
+ #### `PRIMARY KEY`
60
+
61
+ | Feature | Status | Notes |
62
+ |---------|---------|-------|
63
+ | Column-level `PRIMARY KEY` | | Defined with column: `id INT PRIMARY KEY` |
64
+ | Table-level `PRIMARY KEY` || Defined separately: `PRIMARY KEY (id)` |
65
+ | Multi-column `PRIMARY KEY` | | Multiple columns: `PRIMARY KEY (a, b)` |
66
+ | Explicitly named (CONSTRAINT name) | | `CONSTRAINT pk_name PRIMARY KEY (id)` |
67
+ | CLUSTERED/NONCLUSTERED | | Index type options are ignored |
68
+ | Constraint options | | Other options are ignored |
69
+
70
+ #### `FOREIGN KEY`
71
+
72
+ | Feature | Status | Notes |
73
+ |---------|---------|-------|
74
+ | Column-level `FOREIGN KEY` | | Known bug - use table-level syntax instead |
75
+ | Table-level `FOREIGN KEY` | | `FOREIGN KEY (col) REFERENCES other(id)` |
76
+ | Multi-column `FOREIGN KEY` | | `FOREIGN KEY (a, b) REFERENCES other(x, y)` |
77
+ | Explicitly named (CONSTRAINT name) | | `CONSTRAINT fk_name FOREIGN KEY ...` |
78
+ | `ON UPDATE` action | | CASCADE, SET NULL, SET DEFAULT, NO ACTION |
79
+ | `ON DELETE` action || CASCADE, SET NULL, SET DEFAULT, NO ACTION |
80
+ | Constraint options | | Other options are ignored |
81
+
82
+ #### `UNIQUE`
83
+
84
+ | Feature | Status | Notes |
85
+ |---------|---------|-------|
86
+ | Column-level `UNIQUE` | | `col INT UNIQUE` |
87
+ | Table-level `UNIQUE` | | `UNIQUE (col)` |
88
+ | Multi-column `UNIQUE` || `UNIQUE (a, b)` |
89
+ | Explicitly named (CONSTRAINT name) | | `CONSTRAINT uq_name UNIQUE (col)` - name is ignored |
90
+ | CLUSTERED/NONCLUSTERED | | Index type options are ignored |
91
+ | Constraint options | | Other options are ignored |
92
+ | NULLS NOT DISTINCT || Not valid in SQL Server |
93
+ | `UNIQUE KEY`/`UNIQUE INDEX` || MySQL syntax - not valid in SQL Server |
94
+
95
+ #### `CHECK`
96
+
97
+ | Feature | Status | Notes |
98
+ |---------|---------|-------|
99
+ | Column-level `CHECK` | | `col INT CHECK (col > 0)` |
100
+ | Table-level `CHECK` | | `CHECK (col > 0)` |
101
+ | Explicitly named (CONSTRAINT name) | | `CONSTRAINT chk_name CHECK (col > 0)` |
102
+ | WITH CHECK / WITH NOCHECK | | Enforcement options are ignored |
103
+
104
+ #### `DEFAULT`
105
+
106
+ | Feature | Status | Notes |
107
+ |---------|---------|-------|
108
+ | Column-level `DEFAULT` | | `col INT DEFAULT 0` |
109
+ | Table-level `DEFAULT` || Completely ignored |
110
+ | Function as `DEFAULT` | | `DEFAULT GETDATE()`, `DEFAULT NEWID()` |
111
+ | Explicitly named `DEFAULT` | | `CONSTRAINT df_name DEFAULT 0` - name is ignored |
112
+
113
+ #### `NOT NULL` / NULL
114
+
115
+ | Feature | Status | Notes |
116
+ |---------|---------|-------|
117
+ | Column-level `NOT NULL` | | `col INT NOT NULL` |
118
+ | NULL (explicitly nullable) | | `col INT NULL` |
119
+ | Table-level `NOT NULL` | | SQL Server only supports column-level `NOT NULL` |
120
+ | Constraint options | | Other options are ignored |
121
+
122
+ ### Auto-Increment Columns
123
+
124
+ | Feature | Status | Notes |
125
+ |---------|---------|-------|
126
+ | `IDENTITY` (column property) | | `id INT IDENTITY` |
127
+ | `IDENTITY` with seed and increment | | `id INT IDENTITY(1,1)` - starts at 1, increments by 1 |
128
+ | `AUTO_INCREMENT` (column attribute) | | MySQL syntax - not valid in SQL Server |
129
+ | `SERIAL` (pseudo-type) || PostgreSQL syntax - not valid in SQL Server |
130
+ | `BIGSERIAL` (pseudo-type) | | PostgreSQL syntax - not valid in SQL Server |
131
+ | `GENERATED AS IDENTITY` (column property) || SQL standard syntax - parse failure |
132
+
133
+ ### Inline Indexes (in `CREATE TABLE`)
134
+
135
+ | Feature | Status | Notes |
136
+ |---------|---------|-------|
137
+ | Column-level indexes | | Except for `UNIQUE`/`PRIMARY KEY` constraints |
138
+ | Table-level indexes | | Except for `UNIQUE`/`PRIMARY KEY` constraints |
139
+ | Named indexes | | Use `CREATE INDEX` statement |
140
+ | Multi-column indexes | | Use `CREATE INDEX` statement |
141
+ | CLUSTERED/NONCLUSTERED | | Index type options are ignored |
142
+ | Index options | | Use `CREATE INDEX` statement |
143
+
144
+ ### Table/Column Comments (in `CREATE TABLE`)
145
+
146
+ | Feature | Status | Notes |
147
+ |---------|---------|-------|
148
+ | Table comments || SQL Server uses `sp_addextendedproperty` |
149
+ | Column comments | | SQL Server uses `sp_addextendedproperty` |
150
+
151
+ ---
152
+
153
+ ### `CREATE INDEX`
154
+
155
+ | Feature | Status | Notes |
156
+ |---------|---------|-------|
157
+ | Basic `CREATE INDEX` | | `CREATE INDEX idx ON table (col)` |
158
+ | Multi-column index | ✓ | `CREATE INDEX idx ON table (a, b)` |
159
+ | Explicitly named index | ✓ | Index name is required in SQL Server |
160
+ | `UNIQUE` index | ✓ | `CREATE UNIQUE INDEX idx ON table (col)` |
161
+ | CLUSTERED index | ◐ | Index type is ignored |
162
+ | NONCLUSTERED index | ◐ | Index type is ignored |
163
+ | Function-based index | — | SQL Server uses computed columns instead |
164
+ | Partial/Filtered index (WHERE clause) | ◐ | WHERE condition is ignored |
165
+ | INCLUDE columns | ◐ | Covering index columns are ignored |
166
+ | BTREE/HASH | ✗ | PostgreSQL syntax - parse failure |
167
+ | COLLATE | — | Not applicable to SQL Server indexes |
168
+ | Index comments | — | Use `sp_addextendedproperty` |
169
+ | NULLS FIRST/LAST | — | Not valid in SQL Server |
170
+ | ASC/DESC | ◐ | Sort direction is ignored |
171
+ | FULLTEXT index | ✗ | Parse failure |
172
+ | SPATIAL index | ✗ | Parse failure |
173
+
174
+ ---
175
+
176
+ ### `INSERT` Statements
177
+
178
+ | Feature | Status | Notes |
179
+ |---------|---------|-------|
180
+ | Basic `INSERT` ... VALUES | ✓ | `INSERT INTO t (col) VALUES (1)` |
181
+ | Multi-row `INSERT` | ✓ | `INSERT INTO t VALUES (1), (2), (3)` |
182
+ | `INSERT` ... SELECT | ✗ | Subquery as data source |
183
+ | WITH clause (CTE) | ✗ | CTE before `INSERT` |
184
+ | Target table alias | — | Not valid in SQL Server |
185
+ | `INSERT` ... OUTPUT | ◐ | Returns inserted rows - clause is ignored |
186
+ | `INSERT` OVERWRITE | — | Snowflake/Hive syntax - not valid in SQL Server |
187
+ | Multi-table `INSERT` | ✗ | Insert into multiple tables at once |
188
+ | Conditional `INSERT` | ✗ | |
189
+
190
+ ---
191
+
192
+ ### `ALTER TABLE`
193
+
194
+ | Feature | Status | Notes |
195
+ |---------|---------|-------|
196
+ | **ADD COLUMN** | | |
197
+ | - All column properties | ✗ | |
198
+ | **DROP COLUMN** | ✗ | |
199
+ | **ALTER COLUMN** | | |
200
+ | - All modifications | ✗ | |
201
+ | **RENAME COLUMN** | ✗ | |
202
+ | **ADD CONSTRAINT** | | |
203
+ | - Named `DEFAULT` | ✓ | Name is ignored |
204
+ | - `NOT NULL` | ✗ | |
205
+ | - NULL | ✗ | |
206
+ | - Named `CHECK` | ✓ | |
207
+ | - Unnamed `CHECK` | ✓ | |
208
+ | - Named `UNIQUE` | ✓ | |
209
+ | - Unnamed `UNIQUE` | ✓ | |
210
+ | - Named `PRIMARY KEY` | ✓ | |
211
+ | - Unnamed `PRIMARY KEY` | ✓ | |
212
+ | - Named `FOREIGN KEY` | ✓ | |
213
+ | - Unnamed `FOREIGN KEY` | ✓ | |
214
+ | **DROP CONSTRAINT** | ✗ | |
215
+ | **ALTER CONSTRAINT** | ✗ | |
216
+ | **RENAME TABLE (`sp_rename`)** | ✗ | |
217
+ | **TRANSFER (schema change)** | ✗ | |
218
+ | **ADD INDEX** | ✗ | |
219
+
220
+ ---
221
+
222
+ ### Other DDL Statements
223
+
224
+ | Feature | Status | Notes |
225
+ |---------|---------|-------|
226
+ | `DROP TABLE` | ✗ | |
227
+ | `DROP INDEX` | ✗ | |
228
+ | `ALTER INDEX` | ✗ | |
229
+ | `CREATE VIEW` | ✗ | |
230
+
231
+ ---
232
+
233
+ ### Comments (Extended Properties)
234
+
235
+ | Feature | Status | Notes |
236
+ |---------|---------|-------|
237
+ | `sp_addextendedproperty` (table) | ✓ | `MS_Description` for tables - parsing is unreliable |
238
+ | `sp_addextendedproperty` (column) | ✓ | `MS_Description` for columns - parsing is unreliable |
239
+ | `sp_dropextendedproperty` | ✓ | Remove extended property - parsing is unreliable |
240
+
241
+ ---
242
+
243
+ ## Known Limitations
244
+
245
+ - **Column-level `FOREIGN KEY`**: Column-level (inline) `FOREIGN KEY` definitions have a known bug; use table-level syntax instead
246
+ - **`GENERATED AS IDENTITY`**: SQL standard syntax not supported; use `IDENTITY(seed, increment)` instead
247
+ - **Extended properties for comments**: Parsing is unreliable
248
+ - **`ALTER TABLE` operations**: Limited support outside of ADD CONSTRAINT
249
+ - **DDL modification statements**: `DROP TABLE`, `DROP INDEX`, `ALTER INDEX` not supported
250
+ - **`INSERT` ... SELECT**: Subqueries in `INSERT` statements not supported
251
+ - **`CREATE VIEW`**: View definitions are not parsed
252
+ - **Filtered indexes**: WHERE clause is parsed but ignored
253
+ - **Index types**: BTREE, FULLTEXT, SPATIAL fail to parse
254
+
255
+ ## SQL Server-Specific Notes
256
+
257
+ 1. **`IDENTITY` Columns**: SQL Server uses `IDENTITY(seed, increment)` syntax. Both seed and increment values are supported, e.g., `IDENTITY(1,1)` starts at 1 and increments by 1
258
+ 2. **Temporary Tables**: Tables prefixed with `#` (local temp) or `##` (global temp) are recognized as temporary tables
259
+ 3. **Column-level `FOREIGN KEY` Bug**: There is a known bug with column-level (inline) `FOREIGN KEY` syntax. Use table-level `FOREIGN KEY` constraints instead
260
+ 4. **Comments via Extended Properties**: SQL Server doesn't have native comment syntax. Use `sp_addextendedproperty` for `MS_Description`, but parsing is unreliable
261
+ 5. **`ALTER TABLE ADD CONSTRAINT`**: Works well for `CHECK`, `UNIQUE`, `PRIMARY KEY`, and `FOREIGN KEY` - use this as a workaround for `CREATE TABLE` limitations
262
+ 6. **Square Bracket Identifiers**: SQL Server's `[identifier]` syntax is supported in addition to standard double quotes
263
+ 7. **CLUSTERED vs NONCLUSTERED**: SQL Server-specific index options are parsed but ignored in DBML output