Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit f717fa3

Browse files
authored
Merge pull request #1196 from BYHAM/patch-51
CREATE TYPE, formatting.
2 parents f4427a6 + ea65343 commit f717fa3

1 file changed

Lines changed: 26 additions & 34 deletions

File tree

docs/t-sql/statements/create-type-transact-sql.md

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "CREATE TYPE (Transact-SQL) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "02/22/2017"
4+
ms.date: "04/11/2017"
55
ms.prod: "sql-non-specified"
66
ms.reviewer: ""
77
ms.suite: ""
@@ -46,8 +46,7 @@ manager: "jhubbard"
4646
## Syntax
4747

4848
```
49-
50-
Disk-Based Type Syntax
49+
-- Disk-Based Type Syntax
5150
CREATE TYPE [ schema_name. ] type_name
5251
{
5352
FROM base_type
@@ -113,11 +112,12 @@ column_name AS computed_column_expression
113112
```
114113

115114
```
116-
117-
Memory-Optimized Table Type Syntax
115+
-- Memory-Optimized Table Type Syntax
118116
CREATE TYPE [schema_name. ] type_name
119117
AS TABLE ( { <column_definition> }
120-
| [ <table_constraint> ] [ ,... n ] | [ <table_index> ] [ ,... n ] } ) [ WITH ( <table_option> [ ,... n ] ) ]
118+
| [ <table_constraint> ] [ ,... n ]
119+
| [ <table_index> ] [ ,... n ] } )
120+
[ WITH ( <table_option> [ ,... n ] ) ]
121121
[ ; ]
122122
123123
<column_definition> ::=
@@ -131,18 +131,23 @@ column_name <data_type>
131131
[type_schema_name . ] type_name [ (precision [ , scale ]) ]
132132
133133
<column_constraint> ::=
134-
{ PRIMARY KEY { NONCLUSTERED HASH WITH (BUCKET_COUNT = bucket_count) | NONCLUSTERED } }
134+
{ PRIMARY KEY { NONCLUSTERED HASH WITH (BUCKET_COUNT = bucket_count)
135+
| NONCLUSTERED } }
135136
136137
< table_constraint > ::=
137-
{ PRIMARY KEY { NONCLUSTERED HASH (column [ ,... n ] ) WITH (BUCKET_COUNT = bucket_count) | NONCLUSTERED (column [ ASC | DESC ] [ ,... n ] ) } }
138+
{ PRIMARY KEY { NONCLUSTERED HASH (column [ ,... n ] )
139+
WITH (BUCKET_COUNT = bucket_count)
140+
| NONCLUSTERED (column [ ASC | DESC ] [ ,... n ] ) } }
138141
139142
<column_index> ::=
140143
INDEX index_name
141-
{ { [ NONCLUSTERED ] HASH WITH (BUCKET_COUNT = bucket_count) | NONCLUSTERED } }
144+
{ { [ NONCLUSTERED ] HASH WITH (BUCKET_COUNT = bucket_count)
145+
| NONCLUSTERED } }
142146
143147
< table_index > ::=
144148
INDEX constraint_name
145-
{ { [ NONCLUSTERED ] HASH (column [ ,... n ] ) WITH (BUCKET_COUNT = bucket_count) | [NONCLUSTERED] (column [ ASC | DESC ] [ ,... n ] )} }
149+
{ { [ NONCLUSTERED ] HASH (column [ ,... n ] ) WITH (BUCKET_COUNT = bucket_count)
150+
| [NONCLUSTERED] (column [ ASC | DESC ] [ ,... n ] )} }
146151
147152
<table_option> ::=
148153
{
@@ -182,61 +187,51 @@ column_name <data_type>
182187
Specifies whether the type can hold a null value. If not specified, NULL is the default.
183188

184189
*assembly_name*
185-
||
186-
|-|
187-
|**Applies to**: [!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)].|
190+
**Applies to**: [!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)].
188191

189192
Specifies the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] assembly that references the implementation of the user-defined type in the common language runtime. *assembly_name* should match an existing assembly in [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] in the current database.
190193

191194
> [!NOTE]
192195
> EXTERNAL_NAME is not available in a contained database.
193196
194197
**[.** *class_name* **]**
195-
||
196-
|-|
197-
|**Applies to**: [!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)].|
198+
**Applies to**: [!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)].
198199

199200
Specifies the class within the assembly that implements the user-defined type. *class_name* must be a valid identifier and must exist as a class in the assembly with assembly visibility. *class_name* is case-sensitive, regardless of the database collation, and must exactly match the class name in the corresponding assembly. The class name can be a namespace-qualified name enclosed in square brackets (**[ ]**) if the programming language that is used to write the class uses the concept of namespaces, such as C#. If *class_name* is not specified, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] assumes it is the same as *type_name*.
200201

201-
<column_definition>
202+
\<column_definition>
202203
Defines the columns for a user-defined table type.
203204

204205
\<data type>
205206
Defines the data type in a column for a user-defined table type. For more information about data types, see [Data Types &#40;Transact-SQL&#41;](../../t-sql/data-types/data-types-transact-sql.md). For more information about tables, see [CREATE TABLE &#40;Transact-SQL&#41;](../../t-sql/statements/create-table-transact-sql.md).
206207

207-
<column_constraint>
208+
\<column_constraint>
208209
Defines the column constraints for a user-defined table type. Supported constraints include PRIMARY KEY, UNIQUE, and CHECK. For more information about tables, see [CREATE TABLE &#40;Transact-SQL&#41;](../../t-sql/statements/create-table-transact-sql.md).
209210

210-
<computed_column_definition>
211+
\<computed_column_definition>
211212
Defines a computed column expression as a column in a user-defined table type. For more information about tables, see [CREATE TABLE &#40;Transact-SQL&#41;](../../t-sql/statements/create-table-transact-sql.md).
212213

213-
<table_constraint>
214+
\<table_constraint>
214215
Defines a table constraint on a user-defined table type. Supported constraints include PRIMARY KEY, UNIQUE, and CHECK.
215216

216-
<index_option>
217+
\<index_option>
217218
Specifies the error response to duplicate key values in a multiple-row insert operation on a unique clustered or unique nonclustered index. For more information about index options, see [CREATE INDEX &#40;Transact-SQL&#41;](../../t-sql/statements/create-index-transact-sql.md).
218219

219220
INDEX
220221
You must specify column and table indexes as part of the CREATE TABLE statement. CREATE INDEX and DROP INDEX are not supported for memory-optimized tables.
221222

222223
MEMORY_OPTIMIZED
223-
||
224-
|-|
225-
|**Applies to**: [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] and [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)].|
224+
**Applies to**: [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] and [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)].
226225

227226
Indicates whether the table type is memory optimized. This option is off by default; the table (type) is not a memory optimized table (type). Memory optimized table types are memory-optimized user tables, the schema of which is persisted on disk similar to other user tables.
228227

229228
BUCKET_COUNT
230-
||
231-
|-|
232-
|**Applies to**: [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] and [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)].|
229+
**Applies to**: [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] and [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)].
233230

234231
Indicates the number of buckets that should be created in the hash index. The maximum value for BUCKET_COUNT in hash indexes is 1,073,741,824. For more information about bucket counts, see [Indexes for Memory-Optimized Tables](../../relational-databases/in-memory-oltp/indexes-for-memory-optimized-tables.md). *bucket_count* is a required argument.
235232

236233
HASH
237-
||
238-
|-|
239-
|**Applies to**: [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] and [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)].|
234+
**Applies to**: [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)] and [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)].
240235

241236
Indicates that a HASH index is created. Hash indexes are supported only on memory optimized tables.
242237

@@ -280,9 +275,7 @@ FROM varchar(11) NOT NULL ;
280275
### B. Creating a user-defined type
281276
The following example creates a type `Utf8String` that references class `utf8string` in the assembly `utf8string`. Before creating the type, assembly `utf8string` is registered in the local database. Replace the binary portion of the CREATE ASSEMBLY statement with a valid description.
282277

283-
||
284-
|-|
285-
|**Applies to**: [!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)].|
278+
**Applies to**: [!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)] through [!INCLUDE[ssCurrent](../../includes/sscurrent-md.md)].
286279

287280
```
288281
CREATE ASSEMBLY utf8string
@@ -298,7 +291,6 @@ GO
298291
The following example creates a user-defined table type that has two columns. For more information about how to create and use table-valued parameters, see [Use Table-Valued Parameters &#40;Database Engine&#41;](../../relational-databases/tables/use-table-valued-parameters-database-engine.md).
299292

300293
```
301-
/* Create a user-defined table type */
302294
CREATE TYPE LocationTableType AS TABLE
303295
( LocationName VARCHAR(50)
304296
, CostRate INT );

0 commit comments

Comments
 (0)