New-RowVersionColumn

Creates a column object representing an RowVersion datatype.

Syntax

New-RowVersionColumn [-Name] <String> [-Sparse] [-Default <String>] [-Description <String>] [<CommonParameters>]
New-RowVersionColumn [-Name] <String> -NotNull [-Default <String>] [-Description <String>] [<CommonParameters>]

Description

Use this function in the Column script block for Add-Table:

Add-Table 'WithUUID' {
    RowVersion 'ColumnName'
}

ALIASES

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String

The column's name.

true false
NotNull SwitchParameter

Don't allow NULL values in this column.

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

EXAMPLE 1

Add-Table Changes { RowVersion 'Version' }

Demonstrates how to create a table with an optional rowversion column.

EXAMPLE 2

Add-Table Locations { RowVersion 'LocationID' -RowGuidCol }

Demonstrates how to create a table with an optional rowversion, which is used as the RowGuid identifier for SQL Server replication.

EXAMPLE 3

Add-Table Locations { RowVersion 'LocationID' -NotNull }

Demonstrates how to create a table with an required rowversion column.

EXAMPLE 4

Add-Table Locations { RowVersion 'LocationID' -Default 'newid()' }

Demonstrates how to create a table with an optional rowversion column with a default value.

EXAMPLE 5

Add-Table Locations { RowVersion 'LocationID' -Description 'The unique identifier for this location.' }

Demonstrates how to create a table with an optional rowversion column with a description.