Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2007
    Posts
    3

    Unanswered: updating a part of link in SQL

    Need Help...I have to update a link in database. There are about 20,000 of them. I can update the link but i only need to update part of the link. Also, I don't want to touch the AccessionNumber because they are unique. I would like to update DSN=test to DSN=imagecast.

    I'll appreciate any help Thanks in advance!

    UPDATE IDX_attach
    SET image_path = REPLACE (image_path, ‘http://CLINIC001=&Mode=VIEWIMAGE&DSN...=169328’, ‘http://CLINIC001=&Mode=VIEWIMAGE&DSN...nNumber=169328)
    WHERE image_from = ‘IDX Images’
    Last edited by dryroasted_99; 03-21-08 at 11:24.

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    you can use replace to replace only part of a string.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Code:
    UPDATE IDX_attach
    SET image_path = REPLACE (image_path, ‘DSN=test’, ‘DSN=imagecast')
    WHERE image_from = ‘IDX Images’
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Sep 2007
    Posts
    3
    Thank you Guys for your help!

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    blindman, since when did you start using microsoft word curly quotes in your sql?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Hmmm...actually I typed that in notepad.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  7. #7
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you typed ‘DSN=test’ ? betcha you didn't

    you woulda typed 'DSN=test'

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Ah. I see what happened. I copied the characters from the original post.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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