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

authentication - Mongodb revoke acccess to connect test database -

c - getting error: cannot take the address of an rvalue of type 'int' -

How to merge four videos on one screen with ffmpeg -