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

table data restructure

Status
Not open for further replies.

bdichiara

Programmer
Oct 11, 2006
206
US
I'm going to restructure some of the data in my database to run smoother. Currently, I have many rows in my database in with a field called "location" in this format:

link[234]

or

kb[76]

or

search[something in something]

basically, I guess i need 3 separate update queries that will get rid of the part before the "[" along with the "[" and the "]" on each of these rows?

Can someone help me with this query?

_______________
_brian.
 
just one query will do
Code:
update yourtable
   set yourcolumn =
        substring(yourcolumn
          , instr(yourcolumn,'[')+1
          , length(yourcolumn)
           -instr(yourcolumn,'[')-1 )

r937.com | rudy.ca
 
awesome, rudy, that did the trick! thanks!

_______________
_brian.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top