Skip to content

Latest commit

 

History

History
67 lines (52 loc) · 2.75 KB

sys-fn-hadr-distributed-ag-replica-transact-sql.md

File metadata and controls

67 lines (52 loc) · 2.75 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sys.fn_hadr_distributed_ag_replica (Transact-SQL)
sys.fn_hadr_distributed_ag_replica (Transact-SQL)
MikeRayMSFT
mikeray
03/16/2017
sql
system-objects
reference
sys.fn_hadr_distributed_ag_replica
sys.fn_hadr_distributed_ag_replica_TSQL
fn_hadr_distributed_ag_replica
fn_hadr_distributed_ag_replica_TSQL
sys.fn_hadr_distributed_ag_replica
TSQL

sys.fn_hadr_distributed_ag_replica (Transact-SQL)

[!INCLUDE sqlserver2016]

Used to map a replica in a distributed availability group to the local availability group.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

  
sys.fn_hadr_distributed_ag_replica( lag_Id, replica_id )  

Arguments

'lag_Id'
Is the identifier of the distributed availability group. lag_Id is type uniqueidentifier.

'replica_id'
Is the identifier of a replica in the distributed availability group. replica_id is type uniqueidentifier.

Tables Returned

Returns the following information.

Column name Data type Description
group_id uniqueidentifier Unique identifier (GUID) of the local availability group.

Examples

Using sys.fn_hadr_distributed_ag_replica

The following example returns a table with the local availability group identifier that is associated with the specified distributed availability group and replica.

DECLARE @lagId uniqueidentifier = '4A03D1A8-4AE6-B153-E7E9-ED22A546008D'  
DECLARE @replicaId uniqueidentifier = 'D5517513-04A8-FD82-14C6-E684EC913935'  
  
SELECT * FROM sys.fn_hadr_distributed_ag_replica(@lagId, @replicaId)  
GO  

See Also

Always On Availability Groups Functions (Transact-SQL)
Always On Availability Groups (SQL Server)
Distributed Availability Groups (Always On Availability Groups)
CREATE AVAILABILITY GROUP (Transact-SQL)
ALTER AVAILABILITY GROUP (Transact-SQL)