Rafael Copquin
2018-06-13 14:30:10 UTC
I have a SQL Server 2012 Express table with a field called DOB of type DATE
The field accepts NULL values and does not have a default value..
To insert the DOB from VFP I transform it to the form 'YYYY-MM-DD' and send
it as a character string.
However, if the DOB is empty, the only way VFP inserts the record is if the
empty value is sent as ''
and the DOB field displays '1900-01-01' which is the value inserted.
I want to insert NULL in the field, not '1900-01-01'
If I use the SQL Server Management Studio, I can insert the NULL value
directly with this expression:
insert into mydatabase.dbo.employees(name,dob) values( 'John Doe',NULL)
However, this command, from VFP, does not insert the record:
cCmd = [insert into mydatabase.dbo.employees(name,dob) values( 'John
Doe',NULL) ]
sqlexec(nHandle,cCmd)
How can I get the field to get the NULL value?
TIA
Rafael Copquin
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: ***@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/CAHM-jJ0KLxPunmWfTQLkntRcggfbJ0Sff4Kj7Fzrc8e+***@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
The field accepts NULL values and does not have a default value..
To insert the DOB from VFP I transform it to the form 'YYYY-MM-DD' and send
it as a character string.
However, if the DOB is empty, the only way VFP inserts the record is if the
empty value is sent as ''
and the DOB field displays '1900-01-01' which is the value inserted.
I want to insert NULL in the field, not '1900-01-01'
If I use the SQL Server Management Studio, I can insert the NULL value
directly with this expression:
insert into mydatabase.dbo.employees(name,dob) values( 'John Doe',NULL)
However, this command, from VFP, does not insert the record:
cCmd = [insert into mydatabase.dbo.employees(name,dob) values( 'John
Doe',NULL) ]
sqlexec(nHandle,cCmd)
How can I get the field to get the NULL value?
TIA
Rafael Copquin
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: ***@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/CAHM-jJ0KLxPunmWfTQLkntRcggfbJ0Sff4Kj7Fzrc8e+***@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.