Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2010
    Posts
    3

    Unanswered: changing datas in data table

    Hello. I want to change some string values in my database like all "C" values to "D".I have large of values so i cant do that manuel.In pgAdmin , i cant find a feature like replace.How can i do that. thanks and sorry for my English.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Code:
    UPDATE the_table_with_no_name
       SET the_column_with_no_name = replace(the_column_with_no_name, 'C', 'D');
    COMMIT;
    More details in the manual:

    http://www.postgresql.org/docs/current/static/functions-string.html
    http://www.postgresql.org/docs/current/static/sql-update.html

  3. #3
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Do you mean updating text data fields WITHIN tables, or changing object names ???
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  4. #4
    Join Date
    Apr 2010
    Posts
    3
    Shammat thanks for your answer.
    I couldn't ask my question clearly.
    In "image" column there is string datas like "C:\Documents and Settings..0003.jpg",I want to update this data like "D:\Documents and Settings..0003.jpg"
    I only want to update the "C" part to "D".

    I began to learn sql queries but i didn't success this.
    Thanks for all your interest.

  5. #5
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by cagatay murat View Post
    Shammat thanks for your answer.
    I couldn't ask my question clearly.
    In "image" column there is string datas like "C:\Documents and Settings..0003.jpg",I want to update this data like "D:\Documents and Settings..0003.jpg"
    I only want to update the "C" part to "D".
    That's exactly what my statement does.

  6. #6
    Join Date
    Apr 2010
    Posts
    3
    Shammat you are right.
    Yesterday i changed the table and column name but i had error. It did not work.
    But now , i tried and it is succesful. Thanks for all.

  7. #7
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by cagatay murat View Post
    Yesterday i changed the table and column name but i had error. It did not work.
    "It did not work" is not a PostgreSQL error message.

    Next time post the exact statement you ran and theexact error message (use Copy & Paste)

Posting Permissions

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