Skip to main content

I am having an issue where if a date field is blank on the screen, I want to save NULL in my date field in my SQL DB. 

How do I do this with Embedded SQL with Visual COBOL?  I've tried passing spaces, but that saves the date as 1900-01-01, I've tried passing 020202, and that saves the date field as 1955-04-25.

I am having an issue where if a date field is blank on the screen, I want to save NULL in my date field in my SQL DB. 

How do I do this with Embedded SQL with Visual COBOL?  I've tried passing spaces, but that saves the date as 1900-01-01, I've tried passing 020202, and that saves the date field as 1955-04-25.

Hi Amy.

This is what indicator variables are for. If you set the indicator variable associated with a host-variable to -1 and perform an insert or an update then a null will be placed into the corresponding column in the database.

Please see the documentation here


I am having an issue where if a date field is blank on the screen, I want to save NULL in my date field in my SQL DB. 

How do I do this with Embedded SQL with Visual COBOL?  I've tried passing spaces, but that saves the date as 1900-01-01, I've tried passing 020202, and that saves the date field as 1955-04-25.

The picture for date in long format in sql is pic x(23) with date and time combinated