Get-SqlStoredProcedure

Gets an SMO StoredProcedure object.

Syntax

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

Detailed Description

The Get-SqlStoredProcedure function gets a collection of SMO StoredProcedure objects for the specified database.

Related Commands

* Get-SqlStoredProcedure

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-SqlStoredProcedure

Return Values

Microsoft.SqlServer.Management.Smo.StoredProcedure Get-SqlStoredProcedure returns a Microsoft.SqlServer.Management.Smo.StoredProcedure object.

Notes

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

Examples

EXAMPLE 1

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

EXAMPLE 2

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

EXAMPLE 3

Get-SqlDatabase "Z002\sql2K8" pubs | Get-SqlStoredProcedure -name "byroyalty"
This command gets an SMO StoredProcedure object for the byroyalty stored procedure in the pubs database on SQL Server Z002\SQL2K8.