Creates a column object representing an Xml datatype.
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>]
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.
| 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 |
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 |
Add-Table 'WebConfigs' { Xml 'WebConfig' -XmlSchemaCollection 'webconfigschema' }
Demonstrates how to create an optional xml column which uses the webconfigschema schema collection.
Add-Table 'WebConfigs' { Xml 'WebConfig' -XmlSchemaCollection 'webconfigschema' -NotNull }
Demonstrates how to create a required xml column.
Add-Table 'WebConfigs' { Xml 'WebConfig' -XmlSchemaCollection 'webconfigschema'' -Document }
Demonstrates how to create an xml column that holds an entire XML document.