Results 1 to 4 of 4

Thread: SQL Search for INT number and replace with another INT number

  1. #1
    Senior Member skozzy's Avatar
    Join Date
    Jan 2008
    Location
    Brisbane
    Age
    55
    Posts
    525
    Thanks
    31
    Thanked 19 Times in 16 Posts
    Rep Power
    217
    Reputation
    114

    Default SQL Search for INT number and replace with another INT number

    Back with another question. I have a table in a database with a column called OrgObjID which it shows as (int, not null) when I expand it in sql manager. How can I safely find all occurrences of a number 228959 and replace it with 214068 in just that column only.
    Currently I copy and paste the tables contents to Notepad++ search for my number, see which row it is in and go back to SQL and load the table from that row (less a few numbers) then scroll up/down to find what I need to modify. Slow but works. That is why I am here to see if there is a smarter way.



Look Here ->
  • #2
    Junior Member
    Join Date
    Jul 2010
    Posts
    241
    Thanks
    119
    Thanked 131 Times in 84 Posts
    Rep Power
    202
    Reputation
    1341

    Default

    It may depend on the syntax of the database program you are using but the following worked for me in Interbase:

    Update TableA set OrgObjID = 214068 where OrgObjID = 228959
    (replace "TableA" with the name of your database table)

    Don't ask me anything difficult as it is six years since I retired and I haven't used SQL in that time. I was pleased with myself just for remembering the password to get into Interbase.

  • #3
    Senior Member skozzy's Avatar
    Join Date
    Jan 2008
    Location
    Brisbane
    Age
    55
    Posts
    525
    Thanks
    31
    Thanked 19 Times in 16 Posts
    Rep Power
    217
    Reputation
    114

    Default

    wow that was fast, worked a treat. thanks

  • #4
    Senior Member skozzy's Avatar
    Join Date
    Jan 2008
    Location
    Brisbane
    Age
    55
    Posts
    525
    Thanks
    31
    Thanked 19 Times in 16 Posts
    Rep Power
    217
    Reputation
    114

    Default

    I sent you a PM but you can ignor that, I got a little more understanding of the scripting language and managed to do some other find and replaces. You advice gave me a great start.
    Still trying to tackle the Binary32 for editing that. Will get there soon

  • Bookmarks

    Posting Permissions

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