New-BinaryColumn

Creates a column object representing an Binary datatype.

Syntax

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

Description

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

Add-Table 'Images' {
    Binary 'Bits' 256
}

ALIASES

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String

The column's name.

true false
Size Int32

The number of bytes the column will hold.

true false 0
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 'Images' { Binary 'Bytes' 256 }

Demonstrates how to create an optional binary column with a maximum length of 256 bytes.

EXAMPLE 2

Add-Table 'Images' { Binary 'Bytes' 256 -NotNull }

Demonstrates how to create a required binary column with maximum length of 256 bytes.

EXAMPLE 3

Add-Table 'Images' { Binary 'Bytes' -Max }

Demonstrates how to create an optional binary column with the maximum length (2^31 -1 bytes).

EXAMPLE 4

Add-Table 'Images' { Binary 'Bytes' -Max -FileStream }

Demonstrates now to create an optional binary column with the maximum length, and stores the data in a filestream data container.