New-XmlColumn

Creates a column object representing an Xml datatype.

Syntax

New-XmlColumn [-Name] <String> [-XmlSchemaCollection] <String> [-Document] [-Sparse] [-Default <String>] [-Description <String>] [<CommonParameters>]
New-XmlColumn [-Name] <String> [-XmlSchemaCollection] <String> [-Document] -NotNull [-Default <String>] [-Description <String>] [<CommonParameters>]

Description

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

Add-Table -Name 'WebConfigs' -Column {
    Xml 'WebConfig' -XmlSchemaCollection 'webconfigschema'
}

Remember you have to have already created the XML schema before creating a column that uses it.

ALIASES

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String

The column's name.

true false
XmlSchemaCollection String

Name of an XML schema collection

true false
Document SwitchParameter

Specifies that this is a well-formed XML document instead of an XML fragment.

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 'WebConfigs' { Xml 'WebConfig' -XmlSchemaCollection 'webconfigschema' }

Demonstrates how to create an optional xml column which uses the webconfigschema schema collection.

EXAMPLE 2

Add-Table 'WebConfigs' { Xml 'WebConfig' -XmlSchemaCollection 'webconfigschema' -NotNull }

Demonstrates how to create a required xml column.

EXAMPLE 3

Add-Table 'WebConfigs' { Xml 'WebConfig' -XmlSchemaCollection 'webconfigschema'' -Document }

Demonstrates how to create an xml column that holds an entire XML document.