Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass NULL for money field type?
Message
 
À
08/12/2006 11:51:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01176120
Message ID:
01176125
Vues:
8
>Hi,
>How to pass .NULL. for money field type? I tried code below and hit error "unable to convert character type to money data type"
>
>
>lybasic = .NULL.
>
>SQLEXEC(1, "INSERT INTO mytable (myfield) VALUES (?lybasic)")
>
>
>This problem only happen to SQL Server 2000. It works fine for SQl Server 2005
>
>Any ideas?
lybasic = .NULL.

SQLEXEC(1, "INSERT INTO mytable (myfield) VALUES (CAST(?lybasic as money))")
I prefer:
TEXT TO lcSQL NOSHOW PRETEXT 7 TEXTMERGE
     INSERT INTO mytable (myfield) VALUES
            (<<IIF(ISNULL(lybasic),[CAST(NULL as money)],lybasic)>>)
ENDTEXT
SQLEXEC(1, lcSQL)
or even better: NEVER use NULLs in any DataType except DateTime :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform