Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to do this with sql
Message
 
 
À
24/06/2011 22:53:22
Mk Sharma
Shrishti Solutions
Mumbai, Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01515989
Message ID:
01516092
Vues:
51
If the above will be in SQL Server 2008, then it's a very good candidate for MERGE command.

Otherwise UPDATE and INSERT with NOT EXISTS condition.


>
>use 1001\customer again in 0 alias oldcustomer shared 
>use 1002\customer again in 0 alias newcustomer shared
>sele newcustomer
>set order to accode
>sele oldcustomer
>set order to accode
>go top
>do while not eof('oldcustomer')
>     scatter memvar
>     sele newcustomer
>     if  not seek(m.accode,'newcustomer','accode')
>         appe blank in newcustomer
>         gather memvar
>    else
>          if empt(newcustomer.address1)
>             repl newcustomer.address1 with m.address1 in newcustomer
>         endif
>          if empt(newcustomer.address2)
>             repl newcustomer.address2 with m.address2 in newcustomer
>         endif
>    endif
>    sele oldcustomer
>    skip
>enddo
>
>
>
>how to do this with sql.
>
>Warm regards,
>mk.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform