Get-SqlSchema

Gets an SMO schema object.

Syntax

Get-SqlSchema [-database] <Database> [[-name] <String>] [<CommonParameters>]

Detailed Description

The Get-SqlSchema function gets a collection of SMO schema objects for the specified database.

Related Commands

* Get-SqlSchema

Parameters

Name Description Required? Pipeline Input Default Value
database    true  true (ByValue)   
name    false  false   

Input Type

Microsoft.SqlServer.Management.Smo.Database You can pipe SMO database objects to Get-SqlSchema

Return Values

Microsoft.SqlServer.Management.Smo.Schema Get-SqlSchema returns a Microsoft.SqlServer.Management.Smo.Schema object.

Notes

Additional properties including the database, server and extended properties are included in the output.

Examples

EXAMPLE 1

Get-SqlSchema $(Get-SqlDatabase "Z002\sql2K8" pubs)
This command gets a collection of SMO schema objects for SQL Server Z002\SQL2K8, pubs database.

EXAMPLE 2

Get-SqlDatabase "Z002\sql2K8" | Get-SqlSchema
This command gets a collection of SMO schema objects for all user databases on SQL Server Z002\SQL2K8.

EXAMPLE 3

Get-SqlDatabase "Z002\sql2K8" pubs | Get-SqlSchema -name "dbo"
This command gets an SMO schema object for the dbo schema in the pubs database on SQL Server Z002\SQL2K8.