Get-SqlSynonym
Gets an SMO Synonym object.
Syntax
Get-SqlSynonym [-database] <Database> [[-name] <String>] [<CommonParameters>]
Detailed Description
The Get-SqlSynonym function gets a collection of SMO Synonym objects for the specified database.
Related Commands
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-SqlSynonym
Return Values
Microsoft.SqlServer.Management.Smo.Synonym
Get-SqlSynonym returns a Microsoft.SqlServer.Management.Smo.Synonym object.
Notes
Additional properties including the database, server and extended properties are included in the output.
Examples
EXAMPLE 1
Get-SqlSynonym $(Get-SqlDatabase "Z002\sql2K8" AdventureWorks)
This command gets a collection of SMO Synonym objects for SQL Server Z002\SQL2K8, AdventureWorks database.
EXAMPLE 2
Get-SqlDatabase "Z002\sql2K8" | Get-SqlSynonym
This command gets a collection of SMO Synonym objects for all user databases on SQL Server Z002\SQL2K8.
EXAMPLE 3
Get-SqlDatabase "Z002\sql2K8" AdventureWorks | Get-SqlSynonym -name "GrossRevenue"
This command gets an SMO Synonym object for the GrossRevenue synonym in the AdventureWorks database on SQL Server Z002\SQL2K8.