Get-SqlForeignKey
Gets an SMO ForeignKey object.
Syntax
Get-SqlForeignKey [-table] <Object> [<CommonParameters>]
Detailed Description
The Get-SqlForeignKey function gets a collection of SMO ForeignKey objects for the specified table or view.
Related Commands
Parameters
Name |
Description |
Required? |
Pipeline Input |
Default Value |
table |
|
true |
true (ByValue) |
|
Input Type
Microsoft.SqlServer.Management.Smo.Table or
Microsoft.SqlServer.Management.Smo.View
You can pipe SMO objects to Get-SqlForeignKey
Return Values
Microsoft.SqlServer.Management.Smo.ForeignKey
Get-SqlForeignKey returns a Microsoft.SqlServer.Management.Smo.ForeignKey object.
Notes
Additional properties including the database, server and extended properties are included in the output.
Examples
EXAMPLE 1
Get-SqlDatabase "Z002\sql2k8" "pubs" | Get-SqlTable | Get-SqlForeignKey
This command gets a collection of SMO ForeignKey objects for all user tables in the pubs database.