다음을 통해 공유


Synonym 클래스

The Synonym object represents a SQL Server synonym.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo.dll의 Microsoft.SqlServer.Smo

구문

‘선언
<StateChangeEventAttribute("CREATE_SYNONYM", "SYNONYM")> _
<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None Or AutomatedPolicyEvaluationMode.Enforce Or AutomatedPolicyEvaluationMode.CheckOnChanges Or AutomatedPolicyEvaluationMode.CheckOnSchedule)> _
<PhysicalFacetAttribute> _
<StateChangeEventAttribute("RENAME", "SYNONYM")> _
Public NotInheritable Class Synonym _
    Inherits ScriptSchemaObjectBase _
    Implements IObjectPermission, ICreatable, IDroppable, IExtendedProperties,  _
    IScriptable, IAlterable
‘사용 방법
Dim instance As Synonym
[StateChangeEventAttribute("CREATE_SYNONYM", "SYNONYM")]
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None|AutomatedPolicyEvaluationMode.Enforce|AutomatedPolicyEvaluationMode.CheckOnChanges|AutomatedPolicyEvaluationMode.CheckOnSchedule)]
[PhysicalFacetAttribute]
[StateChangeEventAttribute("RENAME", "SYNONYM")]
public sealed class Synonym : ScriptSchemaObjectBase, 
    IObjectPermission, ICreatable, IDroppable, IExtendedProperties, IScriptable, 
    IAlterable
[StateChangeEventAttribute(L"CREATE_SYNONYM", L"SYNONYM")]
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode::None|AutomatedPolicyEvaluationMode::Enforce|AutomatedPolicyEvaluationMode::CheckOnChanges|AutomatedPolicyEvaluationMode::CheckOnSchedule)]
[PhysicalFacetAttribute]
[StateChangeEventAttribute(L"RENAME", L"SYNONYM")]
public ref class Synonym sealed : public ScriptSchemaObjectBase, 
    IObjectPermission, ICreatable, IDroppable, IExtendedProperties, IScriptable, 
    IAlterable
[<SealedAttribute>]
[<StateChangeEventAttribute("CREATE_SYNONYM", "SYNONYM")>]
[<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None|AutomatedPolicyEvaluationMode.Enforce|AutomatedPolicyEvaluationMode.CheckOnChanges|AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
[<PhysicalFacetAttribute>]
[<StateChangeEventAttribute("RENAME", "SYNONYM")>]
type Synonym =  
    class
        inherit ScriptSchemaObjectBase
        interface IObjectPermission
        interface ICreatable
        interface IDroppable
        interface IExtendedProperties
        interface IScriptable
        interface IAlterable
    end
public final class Synonym extends ScriptSchemaObjectBase implements IObjectPermission, ICreatable, IDroppable, IExtendedProperties, IScriptable, IAlterable

주의

The Synonym object provides programmatic access to synonyms. Synonyms can be used to create an alternative name for any SQL Server object.

예제

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server()
'Reference the AdventureWorks database.
Dim db As Database
db = srv.Databases("AdventureWorks")
'Define a Synonym object variable by supplying the parent database, name, and schema arguments in the constructor.
'The name is also a synonym of the name of the base object.
Dim syn As Synonym
syn = New Synonym(db, "Shop", "Sales")
'Specify the base object, which is the object on which the synonym is based.
syn.BaseDatabase = "AdventureWorks"
syn.BaseSchema = "Sales"
syn.BaseObject = "Store"
syn.BaseServer = srv.Name
'Create the synonym on the instance of SQL Server.
syn.Create()

스레드로부터의 안전성

이 형식의 모든 공용 static(Visual Basic에서는 Shared) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.