Export (0) Print
Expand All

LinkedServer Class

A LinkedServer object represents a database system other than SQL Server and is linked to the current instance of SQL Server by using an OLE DB driver.

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)]
[PhysicalFacetAttribute]
public sealed class LinkedServer : NamedSmoObject, 
	ISfcSupportsDesignMode, ICreatable, IDroppable, IAlterable, IScriptable

The LinkedServer type exposes the following members.

  NameDescription
Public methodLinkedServer()Initializes a new instance of the LinkedServer object.
Public methodLinkedServer(Server, String)Initializes a new instance of the LinkedServer object on the specified instance of SQL Server and with the specified name.
Top

  NameDescription
Public propertyCatalogGets or sets the database to be used when the linked server is made through a connection to an OLE DB provider.
Public propertyCollationCompatibleGets or sets the Boolean property value that specifies whether the default collation of the linked server is compatible with the default collation on the local instance of SQL Server.
Public propertyCollationNameGets or sets the name of the collation to use when sorting data from the linked server.
Public propertyConnectTimeoutGets or sets the number of seconds to wait for a connection to be established with the linked server before timing out.
Public propertyDataAccessGets or sets the Boolean property value that specifies whether data can be accessed on the linked server.
Public propertyDataSourceGets or sets the data source to be used when the linked server is made through a connection to an OLE DB provider.
Public propertyDateLastModifiedGets the date and time when the linked server was last modified.
Public propertyDistPublisherGets or sets a Boolean property value that specifies whether the linked server is participating in replication as a distribution Publisher.
Public propertyDistributorGets or sets a Boolean property value that specifies whether the linked server is participating in replication as a distribution Publisher.
Public propertyIDGets the ID value that uniquely identifies the linked server.
Public propertyIsPromotionofDistributedTransactionsForRPCEnabledGets or sets a Boolean property value that specifies whether the promotion of distributed transaction for RPC (remote procedure calls) is enabled.
Public propertyLazySchemaValidationGets or sets the Boolean property value that specifies whether the schema used by the linked server data is validated when the local instance of SQL Server is idle or not.
Public propertyLinkedServerLoginsRepresents a collection of LinkedServerLogin objects. Each LinkedServerLogin object represents a linked server login defined on the linked server.
Public propertyLocationGets or sets the description of the location of the linked server.
Public propertyNameGets or sets a String which contains the name of the LinkedServer. (Overrides NamedSmoObject.Name.)
Public propertyParentGets or sets the Server object that is the parent of the LinkedServer object.
Public propertyProductNameGets or sets the name of the product to which SQL Server can connect through the OLE DB Provider.
Public propertyPropertiesGets a collection of Property objects that represent the object properties. (Inherited from SqlSmoObject.)
Public propertyProviderNameGets or sets the name of the OLE DB provider used to connect to the linked server.
Public propertyProviderStringGets or sets the connection string used to connect to a linked server by way of the OLE DB Provider.
Public propertyPublisherGets or sets a Boolean property value that specifies whether the linked server is a replication Publisher or not.
Public propertyQueryTimeoutGets or sets the time in seconds to wait for a query to execute before timing out.
Public propertyRpcGets or sets the Boolean property value that specifies whether the linked server supports remote procedure calls (RPCs).
Public propertyRpcOutThe Boolean property value that specifies whether the linked server supports remote procedure calls (RPCs) with output parameters.
Public propertyStateGets the state of the referenced object. (Inherited from SmoObjectBase.)
Public propertySubscriberGets or sets the Boolean property value that specifies whether the linked server is a replication Subscriber.
Public propertyUrnGets the Uniform Resource Name (URN) address value that uniquely identifies the object. (Inherited from SqlSmoObject.)
Public propertyUserDataGets or sets user-defined data associated with the referenced object. (Inherited from SmoObjectBase.)
Public propertyUseRemoteCollationGets or sets the Boolean property value that specifies whether to use the collation that is associated with the data from the linked server.
Top

  NameDescription
Public methodAlterUpdates any LinkedServer object property changes on the instance of SQL Server. 
Public methodCreateCreates a linked server on the instance of SQL Server as defined by the LinkedServer object.
Public methodDiscoverDiscovers a list of type Object. (Inherited from SqlSmoObject.)
Public methodDrop()Removes the reference to the linked server from the instance of SQL Server.
Public methodDrop(Boolean)Removes the reference to the linked server from the instance of SQL Server.
Public methodEnumColumns()Enumerates a list of columns that can be accessed on the linked server.
Public methodEnumColumns(String)Enumerates a list of columns that can be accessed on the linked server for a specified table.
Public methodEnumColumns(String, String)Enumerates a list of columns that can be accessed on the linked server for a specified table and schema.
Public methodEnumColumns(String, String, String)Enumerates a list of columns that can be accessed on the linked server for a specified table, schema, and database.
Public methodEnumColumns(String, String, String, String)Enumerates a list of columns that can be accessed on the linked server for a specified column.
Public methodEnumTables()Enumerates a list of tables that are available on the linked server.
Public methodEnumTables(String)Enumerates a list of tables that are available on the linked server for a specified table name.
Public methodEnumTables(String, String)Enumerates a list of tables that are available on the linked server for a specified table name and schema.
Public methodEnumTables(String, String, String)Enumerates a list of tables that are available on the linked server for a specified table name, schema, and database.
Public methodEnumTables(String, String, String, LinkedTableType)Enumerates a list of tables that are available on the linked server for a specified table name, schema, database, and linked table type.
Public methodEquals (Inherited from Object.)
Protected methodFormatSqlVariantFormats an object as SqlVariant type. (Inherited from SqlSmoObject.)
Protected methodGetContextDBGets the context database that is associated with this object. (Inherited from SqlSmoObject.)
Protected methodGetDBNameGets the database name that is associated with the object. (Inherited from SqlSmoObject.)
Public methodGetHashCode (Inherited from Object.)
Protected methodGetPropValueGets a property value of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected methodGetPropValueOptionalGets a property value of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected methodGetPropValueOptionalAllowNullGets a property value of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Protected methodGetServerObjectGets the server of the SqlSmoObject object. (Inherited from SqlSmoObject.)
Public methodGetType (Inherited from Object.)
Public methodInitialize()Initializes the object and forces the properties be loaded. (Inherited from SqlSmoObject.)
Public methodInitialize(Boolean)Initializes the object and forces the properties be loaded. (Inherited from SqlSmoObject.)
Protected methodIsObjectInitializedVerifies whether the object has been initialized. (Inherited from SqlSmoObject.)
Protected methodIsObjectInSpaceVerifies whether the object is isolated or connected to the instance of SQL Server. (Inherited from SqlSmoObject.)
Public methodRefreshRefreshes the object and retrieves properties when the object is next accessed. (Inherited from SqlSmoObject.)
Public methodScript()Generates a Transact-SQL script that can be used to re-create the linked server registration.
Public methodScript(ScriptingOptions)Generates a Transact-SQL script that can be used to re-create the linked server registration as specified by the script options.
Protected methodSetParentImplSets the parent of the SqlSmoObject to the newParent parameter. (Inherited from SqlSmoObject.)
Public methodTestConnectionTests the connection to a linked server.
Public methodToStringReturns a String that represents the referenced object. (Inherited from SqlSmoObject.)
Public methodValidateValidates the state of an object. (Inherited from SmoObjectBase.)
Top

  NameDescription
Public eventPropertyChangedRepresents the event that occurs when a property is changed. (Inherited from SqlSmoObject.)
Public eventPropertyMetadataChangedRepresents the event that occurs when property metadata changes. (Inherited from SqlSmoObject.)
Top

  NameDescription
Explicit interface implemetationPrivate methodIAlienObject.DiscoverDiscovers any dependencies. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate methodIAlienObject.GetDomainRootReturns the root of the domain. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate methodIAlienObject.GetParentGets the parent of this object. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate methodIAlienObject.GetPropertyTypeGets the type of the specified property. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate methodIAlienObject.GetPropertyValueGets the value of the specified property. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate methodIAlienObject.GetUrnGets the Unified Resource Name (URN) of the object. Do not reference this member directly in your code. It supports the SQL Server infrastructure. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate methodIAlienObject.ResolveGets the instance that contains the information about the object from the Unified Resource Name (URN) of the object. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate methodIAlienObject.SetObjectStateSets the object state to the specified SfcObjectState value. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate methodIAlienObject.SetPropertyValueSets the property value. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate methodISfcPropertyProvider.GetPropertySetGets the interface reference to the set of properties of this object. (Inherited from SqlSmoObject.)
Explicit interface implemetationPrivate propertyISfcSupportsDesignMode.IsDesignModeGets or sets the Boolean property value that specifies whether the schema used by the linked server data is validated when the local instance of SQL Server is idle or not.
Top

To get LinkedServer object properties, users can be a member of the public fixed server role.

To set LinkedServer object properties, users must have ALTER ANY LINKED SERVER permission on the server or be a member of the sysadmin fixed server role.

To create or drop a linked server, users must have ALTER ANY LINKED SERVER permission on the server or be a member of the sysadmin fixed server role.

To enumerate tables or columns on the linked server, users must have SELECT permission on the schema.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.  

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft