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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing part of a text string

Status
Not open for further replies.

RWahlert

MIS
May 17, 2004
51
US
I have two tables. One contains zip codes, county names, and salesTaxCode. The second table contains a County,State field, a sales tax percent field, and a salesTaxCode field.

I want to strip out the county name from the County,State field. There is a comma seperating the County and State. I then wnat to use this value to to the County field in th zip code table. Ultimately I want to update salesTaxCode field in the zip cod table with the salesTaxCode from the County,State table.

How can I search the County,State fiekd for the comma so that I can strip out county and link it to the county field in the zip code table?

Example:

Zip Code Table
County salesTaxCode
Albany <NULL>

TaxCode Table

County,State TaxCode
Albany, NY ALB
 
You'll want to use a combination of CharIndex, Left, and Right.



-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Another problem I can see is that counties are not unique across the whole country. Google Jefferson County for instance and see how many states it includes. You could be updating the wrong SalesTaxcode to the county unless you have a way to link the zip code to the state as well as the county. I'm will ing to bet that Jefferson County WV and Jefferson County NY have different tax rates.

"NOTHING is more important in a database than integrity." ESquared
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top