---
title: "SQL-021: Retrieve AD groups for an access group"
summary: Retrieves Active Directory group names associated with an access group code and user type code.
status: draft
owner: <owner>
last_reviewed: 2026-07-24
library: SAIF.Business.External.Users
reference_type: package
---

# SQL-021: Retrieve AD groups for an access group

Retrieves the AD group names that map to a given access group code and user type code, used during AD-group reconciliation for access group management.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-021 |
| **Operation type** | Read |
| **Execution method** | Inline SQL |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | Text |
| **Business object** | `clsUserAccessGroup` |
| **Criteria property** | Local SQL |
| **Lifecycle method** | `ADGroups` property |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:AccessGroupCode` | Input | String | 5 | Access group code to look up AD groups for. |
| `:UserTypeCode` | Input | String | 5 | User type code to scope the lookup. |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [EXT_USER_AD_GROUP](../database-tables.md#ext_user_ad_group) | SELECT | `EXT_USER_AD_GROUP_SEQ_NUM`, `AD_GROUP_NAME` |
| [EXT_USER_ACCESS_GROUP_AD](../database-tables.md#ext_user_access_group_ad) | JOIN | `EXT_USER_AD_GROUP_SEQ_NUM`, `EXT_USER_ACCESS_GROUP_CODE`, `EXT_USER_TYPE_CODE` |

## Sample SQL

```sql
SELECT AD_GROUP_NAME AS ADGroup
FROM EXT_USER_AD_GROUP r
JOIN EXT_USER_ACCESS_GROUP_AD g
    ON g.ext_user_ad_group_seq_num = r.ext_user_ad_group_seq_num
WHERE g.ext_user_access_group_code = :AccessGroupCode
  AND g.ext_user_type_code = :UserTypeCode
```

## Operations and processes
- [User access group management](../operations/user-access-group-management.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Business\SAIF.Business.External.Users\clsUserAccessGroup.vb`
