Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replacing an empty value
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00082951
Message ID:
00082990
Vues:
24
>As some of you may have seen in the other thread, I am now wondering about the best technique to replace an empty value in a varchar field in SQL Server.
>
>As mentioned in the other thread, if we put UPDATE ACRONYM SET ACRONYM='' WHERE PKID=10575, SQL Server will repace the field with a space instead of an empty value.
>
>We also discussed that we can put a null in the field.
>
>Is it our responsability to detect the empty value at save time, like in the UPDATE sample on top, and UPDATE with null as oppose to update with the value when there is a value. Which means something like this:
>
>
>If Len(lcValue)>0
>   UPDATE ACRONYM SET ACRONYM=lcValue WHERE PKID=10575
>   Else
>   UPDATE ACRONYM SET ACRONYM=null WHERE PKID=10575
>EndIf
>
>
>Or, it is a way to do that by using one command?

Because ADO works very similar to VFP's SQL Pass-through in that you pass a character string to the back end as the query, your IF-THEN-ELSE method above is how you would implement this.
"It is an important and popular fact that things are not always what they seem. For instance, on the planet Earth, man had always assumed that he was more intelligent than dolphins because he had achieved so much -- the wheel, New York, wars and so on -- whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man -- for precisely the same reasons." - Douglas Adams
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform