Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pass NULL for money field type?
Message
 
To
08/12/2006 11:51:06
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01176120
Message ID:
01176125
Views:
7
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform