Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    266

    Unanswered: REPLACE name if code like

    Hello

    for MS SQL 2000

    I want to replace a value if a Code LIKE 'A%'

    MyTable :
    ID
    Name
    Code


    SELECT ID, Name, Number FROM MyTable

    but if Code LIKE 'A%' then Name = 'LAN'

    how can i do that ?

    thank you

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    select ID
         , case when Code like 'A%'
                then 'LAN'
                else Name end   as Name
         , Number
      from MyTable
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Dec 2005
    Posts
    266
    it works

    thank you

Posting Permissions

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