Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2013
    Posts
    46

    Unanswered: How do you find and replace in the entire database.

    Hello everyone,

    I have to replace gl_number 25050-80 with gl_number 25050-80 in the entire database. I know how to do that in a table but not in all tables.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    It looks like you're already done from here! Both part numbers are the same!

    Without knowing everything about your schema, triggers, etc. it is really hard to guess what might be required. Specifically, does the database include DRI and/or triggers that implement the UPDATE CASCADE functionality. This problem is equivalent to "I need to replace all of the 3 mm bolts in my car" because without knowing more about your car there is no way for us to guess how many bolts there might be, where you need to look, or what problems you might encounter.

    Finding all of the instances of a string is easier, especially if you can use Full-Text Search functionality. Even once you've found all of the occurrences, replacing them with something different is a much larger problem.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Aug 2004
    Location
    Dallas, Texas
    Posts
    831
    Quote Originally Posted by M1N View Post
    Hello everyone,

    I have to replace gl_number 25050-80 with gl_number 25050-80 in the entire database. I know how to do that in a table but not in all tables.
    Use dynamic SQL. Depending on your SQL version use foreachtable in a cursor. I've done it before.

Posting Permissions

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