>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.