Inserting hascode from QlikView into Table

  • Hi,

    i have hashcode in QlikView in txt file like:

    A'--$Q>F7+O/"ZC.T(3#U,;

    I am trying insert this into table:

    INSERT INTO tbl_Slownik (UniqueID, Data_Zmiany, PESEL, Person_ID, Nazwisko, Imie, Department, Company_NIP, Company_name, Company_shortcut, Systems)
    VALUES (''A'--$Q>F7+O/"ZC.T(3#U,;'', '2017-11-27', '89070811111', 'PH3-30129004', 'Borowska', 'Karolina', 'ITM0', '9730911111', 'ITM Poland', '6F00', 'SAP')

    How can i format bold part because i have an error here? 
    I appreciate all answers,
    thank you,
    Jacek 

  • jaryszek - Monday, November 27, 2017 1:01 AM

    Hi,

    i have hashcode in QlikView in txt file like:

    A'--$Q>F7+O/"ZC.T(3#U,;

    I am trying insert this into table:

    INSERT INTO tbl_Slownik (UniqueID, Data_Zmiany, PESEL, Person_ID, Nazwisko, Imie, Department, Company_NIP, Company_name, Company_shortcut, Systems)
    VALUES (''A'--$Q>F7+O/"ZC.T(3#U,;'', '2017-11-27', '89070811111', 'PH3-30129004', 'Borowska', 'Karolina', 'ITM0', '9730911111', 'ITM Poland', '6F00', 'SAP')

    How can i format bold part because i have an error here? 
    I appreciate all answers,
    thank you,
    Jacek 

    You need to escape the ' which are actually in the string, something like the below

    INSERT INTO tbl_Slownik (UniqueID, Data_Zmiany, PESEL, Person_ID, Nazwisko, Imie, Department, Company_NIP, Company_name, Company_shortcut, Systems)

    VALUES ('A''--$Q>F7+O/"ZC.T(3#U,;', '2017-11-27', '89070811111', 'PH3-30129004', 'Borowska', 'Karolina', 'ITM0', '9730911111', 'ITM Poland', '6F00', 'SAP')

  • Thank you anthony.green.

    I can try it.

    What if i will have a lot of records with hascode and i will want to insert it from flat table for example?
    Signs " ' " will be everywhere within hashcode and sql server can have a problem to read this...

    Jacek

  • jaryszek - Monday, November 27, 2017 2:33 AM

    Thank you anthony.green.

    I can try it.

    What if i will have a lot of records with hascode and i will want to insert it from flat table for example?
    Signs " ' " will be everywhere within hashcode and sql server can have a problem to read this...

    Jacek

    You will need to perform some sort of RegEx, find replace method, depending how your inserting will depend on what solution you need to pick, which looks for the presence of a ' in the string in question and replaces it with a double ' instead

  • Thank you it is very good idea my Friend. 

    Best wishes,
    Jacek

  • Hi,
    I replaced my UniqueID in QlikView directly. 

    Sign ' now is " and sign ; now is |.

    And MS SQL Server is reading this !

    Still have a problem with reading data directly using staging table when UniqueID contains ' and ; 
    Why is this? How can i bypass ConnectionManager in order to load this data? 

    Best Wishes,
    Jacek

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply