Importing from a csv or excel file

(7 posts) (2 voices)

Tags:

  1. brownd92, Member

    Hi there,
    Id like for the user to be able to select a file from their local system then upload it. myDBR should then take the file and import it into a table in the database. However, there needs to be some data mapping from the file to the table as they do not have the same field names.
    Have you any examples of this please?

    Thanks

    David

  2. myDBR Team, Key Master

    David,
    you can do excatcly this with myDBR's import-functionality. myDBR supports both CSV and Excel imports (and JSON and tab delimited text files).

    See documentation for examples.
    --
    myDBR Team

  3. brownd92, Member

    Hi there,
    Thanks for the reply. Unfortunately the documentation isnt really that clear. Do you have a proper sample?

    Thanks

  4. myDBR Team, Key Master

    We improved the documentation with a sample import.

    If the sample is not clear enough or you want additional functionality, let us know.

    --
    myDBR Team

  5. brownd92, Member

    Thanks again for the reply.
    The documentation is much clearer, thanks. However Im getting this error when I try to import:

    DB error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',,,,,,,,,,,,,,'0')' at line 1 SQL call sp_DBR_import_do('1',,,,,,,,,,,,,,,,'0');

    This is my sp_DBR_import_do:

    DROP PROCEDURE IF EXISTS sp_DBR_import_do
    $$
    CREATE PROCEDURE `sp_DBR_import_do`(
    ndApotheek Varchar(10),
    Datumrecept Datetime,
    ndATKODE varchar(45),
    ndAantal Varchar(45),
    sdEenheid Varchar(45),
    sdEtiketnaam Varchar(100),
    sdLevnaam Varchar(100),
    ndWTGKOD Varchar(4),
    ndZorgvrl Int(11),
    ndWTGOpslag Varchar(10),
    Inkoopprijs Varchar(10),
    BedragExcl Varchar(10),
    BedragFactregIncl Varchar(10),
    sdProdgroep Varchar(10),
    ndReceptNr Int(11),
    sdAGBVerzekeraar Varchar(150),
    ndGPKODE Varchar(11))
    BEGIN

    INSERT INTO `myData`.`Table_Data`
    (
    `Afleverapotheek`,
    `Afleverdatum`,
    `Receptnummer`,
    `Recipenummer`,
    `Basisproduct`,
    `Etiketnaam`,
    `Hoeveelheid`,
    `Eenheid`,
    `Z-indexnummer`,
    `Zorgverzekeraar`,
    `ImportDate`)
    VALUES(
    ndApotheek,
    Datumrecept,
    ndReceptNr,
    ndWTGKOD,
    sdEtiketnaam,
    sdEtiketnaam,
    ndAantal,
    sdEenheid,
    ndATKODE,
    sdAGBVerzekeraar,
    CURDATE());

    END
    $$

    I cant see where the error is coming from?

    Thanks

  6. myDBR Team, Key Master

    To see what the ptoblem is, please open a support ticket and include the full error message and your import report with a sample Excel file.

    --
    myDBR Team

  7. brownd92, Member

    Ok Thanks


Reply

You must log in to post.