Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select, Update & partial string replacement
Message
De
30/08/2001 06:17:53
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
30/08/2001 05:59:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00550743
Message ID:
00550747
Vues:
22
>Hi,
>
>I have a Paradox sales.db file accessed via ODBC where I need to change all the first 4 characters of the sales.idnum which is a PK field. I would rather use SQL as in the past this has proved faster than loading a remote view, doing a string replacement and updating the view.
>
>The scenario is as below...
>
>Original sales.idnum
>S0991231
>S0991232
>S0991233
>S0991234
>
>Need to be changed to...
>A0011231
>A0011232
>A0011233
>A0011234
>
>I guess what I am looking for is an SQL equivelant to...
>UPDATE ALL sales.idnum WITH 'A001'+SUBSTR(sales.idnum,5,4)
>
>Regards
>Doug Johnston

Doug,
Substr() might exists in paradox driver as is or as 'substring', stuff as is or as 'replace' ( it has been long not Paradoxed :)
If you could base it on right() then it's almost supported with all.
UPDATE sales ;
 set idnum = 'A001'+right(idnum,4)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform