Creates a relational index on a specified table.
Add-Index [-TableName] <String> [-Clustered] [-ColumnName <String[]>] [-Descending <Boolean[]>] [-FileStreamOn <String>] [-Include <String[]>] [-Name <String>] [-On <String>] [-Option <String[]>] [-SchemaName <String>] [-Timeout <Int32>] [-Unique] [-Where <String>] [<CommonParameters>]
Creates a relational index on a specified table. An index can be created before there is data on the table. Relational indexes can be created on tables or views in another database by specifying a qualified database name.
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Clustered | SwitchParameter | Creates a clustered index, otherwise non-clustered |
false | False | False |
ColumnName | String[] | The column(s) on which the index is based. |
false | False | |
Descending | Boolean[] | Optional array of booleans to specify descending switch per column. Length must match |
false | False | |
FileStreamOn | String | The value of the |
false | False | |
Include | String[] | Column names to include in the index. |
false | False | |
Name | String | The name for the |
false | False | |
On | String | The value of the |
false | False | |
Option | String[] | An array of index options. |
false | False | |
SchemaName | String | The schema name of the target table. Defaults to |
false | False | |
TableName | String | The name of the target table. |
true | False | |
Timeout | Int32 | The number of seconds to wait for the add operation to complete. Default is 30 seconds. |
false | False | |
Unique | SwitchParameter | Create a unique index on a table or view. |
false | False | False |
Where | String | The filter to use when creating a filtered index. |
false | False |
None.
Rivet.Operations.AddIndexOperation.
Add-Index -TableName Cars -Column Year
Adds a relational index in 'Year' on the table 'Cars'
Add-Index -TableName 'Cars' -Column 'Year' -Unique -Option @('IGNORE_DUP_KEY = ON','ALLOW_ROW_LOCKS = OFF')
Adds an unique relational index in 'Year' on the table 'Cars' with options to ignore duplicate keys and disallow row locks.
Add-Index -TableName 'Cars' -Column 'Year' -Include 'Model'
Adds a relational index in 'Year' on the table 'Cars' and includes the column 'Model'