SPRING / Phone Number Reference
Portable SQL Server setup
SQL Server handoff · Google libphonenumber v9.0.39

Phone lookups,
ready to use.

A pinned Google lookup dataset, a repeatable SQL Server installer, an exact-content validator, and the original downloaded files in one portable package.

215calling codes
254region rows
32,497NANP prefixes

What is installed

dbo.PhoneCountryRegion maps international calling codes to all regions Google lists for each code. Shared codes have multiple rows; 001 represents a non-geographic service.

dbo.PhonePrefixGeography contains English NANP prefix labels. Use the longest matching prefix for the most specific available description.

dbo.PhoneSourceManifest records the pinned tag, commit, counts, and import hashes.

What the labels mean

Google’s place text is a descriptive phone-prefix lookup. It does not establish whether a number is active, where its current user lives, or a current area-code assignment status.

For administrative NPA status use NANPA reports. For authoritative E.164 assignments use the ITU list.

This package contains Google data. NANPA and ITU data are linked for reference and are not loaded into these tables.

Install on your SQL Server

  1. Download and extract the complete ZIP.
  2. Open PowerShell 7 or Windows PowerShell 5.1 on a computer that can reach the target SQL Server.
  3. Use a login with permission to create the database and tables. Enter the target when prompted.
  4. Keep the package for later validation and repeat installs.
$target = Read-Host 'Target SQL Server or instance'
& .\Install-PhoneNumberReference.ps1 -SqlInstance $target

The installer creates the database and three tables, replaces the imported rows in a transaction, then runs validation. It can be run again.

Target options

Server: supplied at run time
Default database: PhoneNumberReference
Default authentication: Windows integrated
Source: Google libphonenumber v9.0.39

Use -Database to choose a database name, or -SqlCredential (Get-Credential) for SQL authentication. Connections are encrypted. Use -TrustServerCertificate only when you have confirmed the target and its certificate is not trusted by the client. Python is needed only to regenerate the CSVs.

The installer replaces rows in its three dedicated tables. Review that behavior before using it against a database where those table names already exist.

Find the place label

Connect to the database selected during installation. Supply digits only, including the international calling code. Longer matches take precedence over broad prefixes.

DECLARE @Digits varchar(20) = '13125551212';
SELECT TOP (1) FullPrefix, LocationText
FROM dbo.PhonePrefixGeography
WHERE Locale = 'en'
  AND LEFT(@Digits, LEN(FullPrefix)) = FullPrefix
ORDER BY LEN(FullPrefix) DESC;

Find the regions for a code

One calling code can serve several regions. Query all rows, then use IsPrimaryRegion where a display needs one default.

SELECT CallingCode, RegionCode,
       IsPrimaryRegion
FROM dbo.PhoneCountryRegion
WHERE CallingCode = '1'
ORDER BY IsPrimaryRegion DESC,
         RegionCode;

The package includes more SQL examples.

Run the validator

& .\Test-PhoneNumberReference.ps1 -SqlInstance $target

Use the same database and authentication options as the installer. The validator checks SHA-256 for the downloaded originals and generated CSVs, compares every CSV row with SQL, confirms stored version and commit metadata, and tests a longest-prefix result.

Expected package counts: 254 country-region rows and 32,497 prefix rows.

Accuracy boundary

The validator establishes that SQL matches this captured Google release. It cannot determine whether Google’s labels reflect today’s number assignments or a subscriber’s physical location.

Google’s tagged repository is the source. The package pins commit 670015c8aec4c3a84769c664f194677201236b43 and includes its Apache 2.0 license.

Complete handoff

Everything required for an offline install is in the archive, including the original Google files, generated CSVs, installer, validator, SQL schema, examples, and manifest.

Download complete package ↓

Captured from Google libphonenumber v9.0.39. Keep the license with redistributed files.