update

From: "cristi" <cristi(at)dmhi(dot)ct(dot)ro>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: update
Date: 2002-02-26 06:43:14
Message-ID: 004d01c1be90$de2ddc00$7201a8c0@dmhi.ct.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a table (my_table) with this structure:
codlm varchar(7)

The records are:
45122AD
45122AD
45123AC
440331B
430332C
440222X

I want to change the first 2 letters from 45 to 22 something like this:

22122AD
22122AD
22123AC
440331B
430332C
440222X

I tried:
update my_table set codlm='22'||substring(codlm,2) where codlm like '45'

but the result is:

225
225
225
440331B
430332C
440222X

Where is the mistake?

Thanks!

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Masse Jacques 2002-02-26 16:22:45 references and inheritance
Previous Message Tom Lane 2002-02-26 03:34:38 Re: Can't use PGAccess with KDE 2.2