Creates a column object representing an UniqueIdentifier datatype.
New-UniqueIdentifierColumn [-Name] <String> [-RowGuidCol] [-Sparse] [-Default <String>] [-Description <String>] [<CommonParameters>]
New-UniqueIdentifierColumn [-Name] <String> [-RowGuidCol] -NotNull [-Default <String>] [-Description <String>] [<CommonParameters>]
Use this function in the Column
script block for Add-Table
:
Add-Table 'WithUUID' {
UniqueIdentifier 'ColumnName'
}
Name | Type | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
Name | String | The column's name. |
true | false | |
RowGuidCol | SwitchParameter | Sets RowGuidCol |
false | false | False |
NotNull | SwitchParameter | Don't allow |
true | false | False |
Sparse | SwitchParameter | Store nulls as Sparse. |
false | false | False |
Default | String | A SQL Server expression for the column's default value |
false | false | |
Description | String | A description of the column. |
false | false |
Add-Table Locations { UniqueIdentifier 'LocationID' }
Demonstrates how to create a table with an optional uniqueidentifier
column.
Add-Table Locations { UniqueIdentifier 'LocationID' -RowGuidCol }
Demonstrates how to create a table with an optional uniqueidentifier
, which is used as the RowGuid identifier for SQL Server replication.
Add-Table Locations { UniqueIdentifier 'LocationID' -NotNull }
Demonstrates how to create a table with an required uniqueidentifier
column.
Add-Table Locations { UniqueIdentifier 'LocationID' -Default 'newid()' }
Demonstrates how to create a table with an optional uniqueidentifier
column with a default value.
Add-Table Locations { UniqueIdentifier 'LocationID' -Description 'The unique identifier for this location.' }
Demonstrates how to create a table with an optional uniqueidentifier
column with a default value.