New-MoneyColumn

Creates a column object representing an Money datatype.

Syntax

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

Description

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

Add-Table 'Items' {
    Money 'Price'
}

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 'Items' { Money 'Price' }

Demonstrates how to create an optional money column called Price.

EXAMPLE 2

Add-Table 'Items' { Money 'Price' -NotNull }

Demonstrates how to create a required money column called Price.

EXAMPLE 3

Add-Table 'Items' { Money 'Price' -Sparse }

Demonstrates how to create a sparse, optional money column called Price.

EXAMPLE 4

Add-Table 'Items' { Money 'Price' -NotNull -Default '0.00' }

Demonstrates how to create a required money column called Price with a default value of $0.00.

EXAMPLE 5

Add-Table 'Items' { Money 'Price' -NotNull -Description 'The price of the item.' }

Demonstrates how to create a required money column with a description.