New-NCharColumn

Creates a column object representing an NChar datatype.

Syntax

New-NCharColumn [-Name] <String> [-Size] <Int32> [-Collation <String>] [-Sparse] [-Default <String>] [-Description <String>] [<CommonParameters>]
New-NCharColumn [-Name] <String> [-Size] <Int32> [-Collation <String>] -NotNull [-Default <String>] [-Description <String>] [<CommonParameters>]

Description

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

Add-Table -State 'Addresses' -Column {
    NChar 'State' 2
}

ALIASES

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String

The column's name.

true false
Size Int32

Defines the string Size of the fixed-Size string data. Default is 30

true false 0
Collation String

Controls the code page that is used to store the data

false 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 'Addresses' { NChar 'State' 2 }

Demonstrates how to create an optional nchar column with a length of 2 bytes.

EXAMPLE 2

Add-Table 'Addresses' { NChar 'State' 2 -NotNull }

Demonstrates how to create a required nchar column with length of 2 bytes.

EXAMPLE 3

Add-Table 'Addresses' { NChar 'State' 2 -Collation 'Latin1_General_BIN' }

Demonstrates now to create an optional nchar column with a custom Latin1_General_BIN collation.