Error when trying to insert dates into database
Ältere Kommentare anzeigen
When I use the insert function to write multiple rows of data to a database, I receive an error.
I'm using the insert function like this:
insert(conn,tableName,colNames,data_table);
One of my columns is a date. I've tried inserting the data in various formats: 'YYYY-MM-DD' and 'YYYY-MM-DD HH:MM:SS'. For some reason I continue to get this error:
Error using database.ODBCConnection/insert (line 189)
ODBC Driver Error: Invalid string or buffer length
When I try to insert the data without the date column, the insert function works without error. When I write SQL to insert the data, including dates, with the exec function the format 'YYYY-MM-DD' is accepted:
exec(conn,sql_string);
It seems like the date column is what is causing the problem with the insert function, because it works when I eliminate that column. Are there any suggestions for fixing this error? Thanks.
Antworten (0)
Kategorien
Mehr zu Calendar finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!