Databases: Problem importing DATE field into MySQL

Databases: Problem importing DATE field into MySQL

by Brian Maynes -
Number of replies: 4

I am trying to import over 1700 users into the mdl_user table and all my critical data is importing nicely except for two custom fields added to the table- "hiredate" and "employeenum". When I select the import file (.csv) I get the following message:

"hiredate" is not a valid field name.

Any idea why I might be getting this error (besides the fact that it's not a valid field name wink )? If I remove hiredate altogether, I get the same message for the emplopyeenum field. There must be some field definition I am not setting in MySQL, but I don't know what/where it is.

Any help would be appreciated...thanks!

Brian

Average of ratings: -
In reply to Brian Maynes

Re: Databases: Problem importing DATE field into MySQL

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The standard mdl_user table does not have any fields called hiredate and employeenum, so unless you add those two fields manually to that table definition, you won't be able to import the data.

Saludos. Iñaki.
In reply to Brian Maynes

Re: Databases: Problem importing DATE field into MySQL

by Steve Power -

Brian

Where were you hoping to store this information within the moodle user data? I have imported similar fields by replacing the name in the csv header with the name of the moodle user field where I wanted to store the data.

For example you might keep "employeenum" in the ID number field in moodle by replacing "employeenum" with "idnumber" in the first line of your csv file.

I am not sure where you might store "hiredate" but you could try editing user accounts to see which existing field the data best fits into.

Regards
Steve

In reply to Steve Power

Re: Databases: Problem importing DATE field into MySQL

by Brian Maynes -

Thanks Steve...I should have thought of using idnumber long ago. That worked like a champ. Not having much luck with hiredate however...

Regards...Brian

In reply to Brian Maynes

Re: Databases: Problem importing DATE field into MySQL

by Steve Power -

Brian

Glad idnunmber was OK.

Most of the existing fields could hold hiredate. I would guess it would just be a matter of picking a field that you are not using, possibly MSN ID (msn). You could even edit the language to change the text (msnid) to "Hire Date" or whatever suits. If you do this though I suggest you adopt a custom language pack (see Helen's advice here).

Regards
Steve