---
title: "SQL-203: ProviderQueryProvider.GetProviderByTaxId"
summary: Read operation for `ProviderQueryProvider.GetProviderByTaxId`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-203: ProviderQueryProvider.GetProviderByTaxId

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by `ProviderQueryProvider.GetProviderByTaxId`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-203 |
| **Operation type** | Read |
| **Execution method** | ORM (NHibernate LINQ) |
| **Database** | Oracle* |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `ProviderQueryProvider` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `GetProviderByTaxId` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `taxId` | Input | string | N/A | Method argument of `ProviderQueryProvider.GetProviderByTaxId` bound into the ORM expression; NHibernate generates the bind variable at runtime |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [PROVIDER_TAX_ID](../database-tables.md#provider_tax_id) | SELECT | TAX_ID, REGISTERED_NAME, TAX_ID_DISPLAY_DESCR, EFF_DATE, EXP_DATE, PROVIDER_SEQ_NUM |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:58`. The repository/queryable is initialised at `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:28`.

```csharp
// Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:28
_providerTaxIdRepository = Factory.GetRepository<ProviderTaxId>().Query();

// Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:58
if (includeNonPrimaryTaxIds)
{
    var providerTaxId = _providerTaxIdRepository.FirstOrDefault(pr => pr.TaxId == taxId);
```

## Sample SQL

> **Inferred SQL:** This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT * FROM (
  SELECT
    PTI.TAX_ID,
    PTI.REGISTERED_NAME,
    PTI.TAX_ID_DISPLAY_DESCR,
    PTI.EFF_DATE,
    PTI.EXP_DATE,
    PTI.PROVIDER_SEQ_NUM
  FROM PROVIDER_TAX_ID PTI
  WHERE PTI.TAX_ID = :taxId
) WHERE ROWNUM <= 1
```

Translation notes:
- This statement runs only when `includeNonPrimaryTaxIds` is `true`. The follow-on provider load is SQL-204.
- `TaxId` is the entity Id (`ProviderTaxIdMap.cs:13`), so the ROWNUM limit is defensive only.

## Operations and processes

- [Provider queries](../operations/provider-queries.md)

## Business rules

- [SD-BR-080 Provider identity relationship and address code sets](../business-rules.md#sd-br-080-provider-identity-relationship-and-address-code-sets)
- [SD-BR-082 Dismissed bills excluded from provider location ids](../business-rules.md#sd-br-082-dismissed-bills-excluded-from-provider-location-ids)
- [SD-BR-083 Provider in MCO only within date window](../business-rules.md#sd-br-083-provider-in-mco-only-within-date-window)

## Sources
- `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:58`
