Search code examples
c#sqlsql-serverpostal-code

How to find candian postal code between low and High by SQL Server or c#


I just want to know how to find Canada or UK postal between low and High Postal code.

For Example: Low postal code: A0A0A0 and High is: A0Z9Z9

How to find postal code between these postal A0A0A0 and A0Z9Z9?


Solution

  • You can use LIKE pattern matching

    WHERE Code LIKE 'A0[A-Z][0-9][A-Z][0-9]'