New-VarBinaryColumn

Creates a column object representing an VarBinary datatype.

Syntax

New-VarBinaryColumn [-Name] <String> [-Size] <Int32> [-Sparse] [-Default <String>] [-Description <String>] [<CommonParameters>]
New-VarBinaryColumn [-Name] <String> [-Size] <Int32> -NotNull [-Default <String>] [-Description <String>] [<CommonParameters>]
New-VarBinaryColumn [-Name] <String> -Max [-FileStream] -NotNull [-Default <String>] [-Description <String>] [<CommonParameters>]
New-VarBinaryColumn [-Name] <String> -Max [-FileStream] [-Sparse] [-Default <String>] [-Description <String>] [<CommonParameters>]

Description

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

Add-Table 'Images' {
    VarBinary 'Bits' 8000
}

ALIASES

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String

The column's name.

true false
Size Int32

The maximum number of bytes the column will hold.

true false 0
Max SwitchParameter

Creates a varbinary(max) column.

true false False
FileStream SwitchParameter

Stores the varbinary(max) data in a filestream data container on the file system. Requires VarBinary(max).

false 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 'Images' { VarBinary 'Bytes' 8000 }

Demonstrates how to create an optional varbinary column with a maximum length of 8000 bytes.

EXAMPLE 2

Add-Table 'Images' { VarBinary 'Bytes' 8000 -NotNull }

Demonstrates how to create a required varbinary column with maximum length of 8000 bytes.

EXAMPLE 3

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

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

EXAMPLE 4

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

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