StoredProcedures 属性

表示 StoredProcedure 对象的集合。每个 StoredProcedure 对象都表示对数据库定义的一个存储过程。

命名空间:  Microsoft.SqlServer.Management.Smo
程序集:  Microsoft.SqlServer.Smo(在 Microsoft.SqlServer.Smo.dll 中)

语法

声明
<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny,  _
    GetType(StoredProcedure), SfcObjectFlags.Design)> _
Public ReadOnly Property StoredProcedures As StoredProcedureCollection
    Get
用法
Dim instance As Database
Dim value As StoredProcedureCollection

value = instance.StoredProcedures
[SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(StoredProcedure), SfcObjectFlags.Design)]
public StoredProcedureCollection StoredProcedures { get; }
[SfcObjectAttribute(SfcContainerRelationship::ObjectContainer, SfcContainerCardinality::ZeroToAny, 
    typeof(StoredProcedure), SfcObjectFlags::Design)]
public:
property StoredProcedureCollection^ StoredProcedures {
    StoredProcedureCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ObjectContainer, SfcContainerCardinality.ZeroToAny, 
    typeof(StoredProcedure), SfcObjectFlags.Design)>]
member StoredProcedures : StoredProcedureCollection
function get StoredProcedures () : StoredProcedureCollection

属性值

类型:Microsoft.SqlServer.Management.Smo. . :: . .StoredProcedureCollection
一个 StoredProcedureCollection 对象,该对象表示对数据库定义的所有存储过程。

注释

Specific stored procedures can be referenced by using this collection by specifying the name of the stored procedure. To add a new stored procedure to the collection, call the stored procedure constructor StoredProcedure.

示例

VB

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server

'Reference the AdventureWorks2008R2 database.
Dim db As Database
db = srv.Databases("AdventureWorks2008R2")

'Display all the stored procedures in the database.
Dim sp As StoredProcedure
For Each sp In db.StoredProcedures
   Console.WriteLine(sp.Name)
Next

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")

Foreach ($sp in $db.StoredProcedures)
{
   Write-Host $sp.Name
}