#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2007
    Posts
    18
    Rep Power
    0

    Using REPLACE in a UPDATE statement


    Is there any way to do a REPLACE into a record, using an UPDATE statement?

    In Sql Server I can do this:

    UPDATE Tbl1 SET Rec1= REPLACE(Rec1, 'SomeValue', '')

    How can I do this in Firebird?

    Thanks
  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2007
    Posts
    18
    Rep Power
    0
    Ok, I'll try it later.

    Thanks
  6. #4
  7. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2007
    Posts
    18
    Rep Power
    0
    yeah.. the server was down just for a few minutes
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2007
    Posts
    18
    Rep Power
    0
    Ok. I'm trying it, and it sounds great.

    However, this requires to add some functions to the database(s) you want to use it. In my server I have about 500 db's, and executing the sql's for each db is too much dangerous.

    Is there any other way to do the task, that not suppose a modify of the db's?
  12. #7
  13. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
    Originally Posted by Borjaserrano
    ...
    Is there any other way to do the task, that not suppose a modify of the db's?
    AFAIK no , but as the sql is always the same I don't think that danger comes from the number of times it is executed
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2007
    Posts
    18
    Rep Power
    0
    Well, I did a small tool in .NET to execute the sql scripts I need to add the rFunc features to our databases. This tool just takes the db name and local path of all db's from another db and then executes the script for each db.

    However, I'm getting this exception every time I execute the sql script:
    Dynamic SQL Error
    SQL error code = -104
    Token unknown - line 7, char 1
    DECLARE

    Weird, because line 7 is refered to the second DECLARE statement of the script.

    I'm executing the script by a objBD.ExecuteNonQuery() sentence of a FbCommand object.

    Maybe I must to execute one DECLARE statement in one ExecuteNonQuery sentence?
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2007
    Posts
    18
    Rep Power
    0
    Thanks mate, finally I added all the functions of rFunc to all databases and now works perfect.

    I had to use a FbScript object and a FbBatchExecution object instead FbCommand

    Comments on this post

    • pabloj agrees

IMN logo majestic logo threadwatch logo seochat tools logo