Install on your SQL Server
- Download and extract the complete ZIP.
- Open PowerShell 7 or Windows PowerShell 5.1 on a computer that can reach the target SQL Server.
- Use a login with permission to create the database and tables. Enter the target when prompted.
- Keep the package for later validation and repeat installs.
$target = Read-Host 'Target SQL Server or instance'
& .\Install-PhoneNumberReference.ps1 -SqlInstance $target
Copy-ready command
Replace <server-or-instance> with the destination SQL Server name. Keep this command on one line:
.\Install-PhoneNumberReference.ps1 -SqlInstance '<server-or-instance>' -Database 'PhoneNumberReference' -TrustServerCertificate
The installer creates the database and four tables, replaces the imported rows in a transaction, then runs validation. It can be run again. Use -TrustServerCertificate only when the destination requires it.
Target options
Server: supplied at run time
Default database: PhoneNumberReference
Default authentication: Windows integrated
Sources: Google libphonenumber v9.0.39 and Unicode CLDR 48.2
Use -Database to choose a database name, or -SqlCredential (Get-Credential) for SQL authentication. Connections are encrypted. -TrustServerCertificate is a switch and takes no value. If you split a command across lines, each PowerShell backtick must be the final character on its line; do not use a backslash.
The installer replaces rows in its four dedicated tables. Review that behavior before using it against a database where those table names already exist.
Upgrade an existing installation
Download and extract the newest complete ZIP into a new folder. Run the installer against the same SQL Server and database used by the current installation:
$target = Read-Host 'Target SQL Server or instance'
& .\Install-PhoneNumberReference.ps1 `
-SqlInstance $target `
-Database 'PhoneNumberReference' `
-TrustServerCertificateKeep the final line only when the target certificate requires it. -TrustServerCertificate is a PowerShell switch, so do not write -TrustServerCertificate true.
The upgrade keeps the database, creates missing objects such as dbo.PhoneRegionName, adds newer manifest columns, replaces the package-owned table rows in a transaction, and runs the validator automatically. Refresh the Tables folder in your SQL editor after the command reports PASS.
SELECT c.CallingCode,
c.RegionCode,
n.RegionName,
c.IsPrimaryRegion
FROM dbo.PhoneCountryRegion AS c
JOIN dbo.PhoneRegionName AS n
ON n.RegionCode = c.RegionCode
AND n.Locale = 'en'
WHERE c.CallingCode = '44'
ORDER BY c.IsPrimaryRegion DESC,
c.RegionCode;The primary row should be GB — United Kingdom. If the existing installation uses another database name, supply that exact name with -Database.