Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Location
    Dallas, TX
    Posts
    3

    Unanswered: Update query question

    This is my query:
    UPDATE [Table] Set [Field] = REPLACE ([Field],'[Value]','[Value]').
    How do I make the first string value absolute? I'm trying to replace 'St' with 'Saint'. How do I make sure that the query does not find every instance of 'st', i.e. turning street into saintreet?

    Thanks for your help.

    Rob

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    how about something like this?

    Code:
    --------------------------------------------------------------------------------------------------
    create table #tmp(f1 varchar(25))
    insert into #tmp values('street')
    insert into #tmp values('st louis')
    insert into #tmp values('st. joe')
    insert into #tmp values('st louis, st. joe')
    select * From #tmp
    update #tmp set f1 = replace(f1,'st ','saint ')
    select * From #tmp
    update #tmp set f1 = replace(f1,'st. ','saint ')
    select * From #tmp
    --------------------------------------------------------------------------------------------------
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •