Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL loop

Status
Not open for further replies.

mttorpy

MIS
Feb 26, 2004
29
US

I have eight original columns and one column I have added for solving this problem.

For every range of zip codes, I would like to break them up into single records, the problem being I have 3156 records.

So, I need to construct a script in SQL that with create an additional record for every zip in the range and keep all information to the left of Zip1 the same for the additional records in that range.

Any ideas?
I would be happy to do it in Excel or VB.net using Notepad, then exporting if easier.

Thanks






 
can you provide a data sample?

"Shoot Me! Shoot Me NOW!!!"
- Daffy Duck
 

Here is an example of two records, after the split I would need three more records created.

pcode bit Counrty state city zip1 zip2 #xtrarecords
300 0 usa al prat 36066 36068 2


pcode bit Counrty state city zip1 zip2 #xtrarecords
1100 0 usa mt prat 36532 36533 1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top