Update fields

Posted on 2009-12-21
Last Modified: 2012-05-08
I have a table called MyTable and have few columns in it.  There is a field called Relation but this field may contain the following attributes:

So I want to update the MyTable -  where ever it find OBR_XX and Non_OBR in the Relation field; I want to change into OBR.  At the end the Relationship field should only contain this:
Question by:karinos57
    LVL 75

    Accepted Solution

    update Mytable
    set Relation = 'OBR'
    WHERE Relation in ( 'OBR_XX' , 'Non_OBR' )

    Expert Comment

    Other wise u can use this
    update Mytable
    set Relation = 'OBR'
    WHERE Relation like '%OBR%'

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now