sql server 2008 - Generate Zip Codes Between two ranges -


i attempting display of zip codes between 2 ranges in database. data looks this:

  • zip start zip end state
  • 00501 06390 ny
  • 10001 10314 ny
  • 10451 11003 ny

i hoping display data as

  • 00501 ny
  • 00502 ny
  • 00503 ny
  • 00504 ny ect.

any appreciated.

select * yourtablename cast(trim(substring(yourzipcodefield, 0, 5)) unsigned) between 'fromrange' , 'torange' 

hoping helpful. above query self defines took substring, temporarily converted numeric value, , selected range.


Comments

Popular posts from this blog

php - Extract Text from HTTP referer -

Receive udp packets in android gstreamer -

authentication - ASP.NET Core 1.0. Bearer Token, cannot access custom claims -