When importing data into a binary datatype field we where scripting 0x<data>. For SAP Hana this should be inserted in as a string '<data>'
-----------------------------------------------------------------------------------------------------------------------------------------------------------
When I use the import data functionality and try to import varbinary data e.g. 0017A44BD41D1EE0AEB6B84DB6A82BE6 out of a text file, ADS converts this value into 0x0017A44BD41D1EE0AEB6B84DB6A82BE6. Why ?
The import statement fails with
inconsistent datatype: INT type is incompatible with VARBINARY type
The table field is type
VARBINARY(16)
|
99 KB
![]() |
5 KB
![]() |
161 B
![]() |
5 KB
|
65 KB
|
125 KB
|
118 KB
|
12 KB
Modification made to the import thread to handle the binary datatype as a string quoted column.
Committed revision: 49096
Changes required in the following classes to correctly build the binary string:
CoreLibImportThread DataTableModel DSTableWriter ETLUtil ImportExcelImportThread ImportThread
Changes where required in the following classes to correctly build the insert, update & delete statements in the table data editor:
AFBaseDBObject AFTableColumnInitHana
I tested the table data editor, import from file, import from excel and export to file.
for further testing we should create tables with binary types, insert data via table data editor, import and export data, and any other locations that work with the table's data.
We are using the HEXTOBIN(<String>) database function to work with the binary datatype. This was required in order to correctly compare the string in the WHERE Clause. If the user disables the File->Option->Results->Data Retrieval -> [Convert Binary to hex], attempting to modify the binary code using table data editor will fail.
Binary datatype is now modifiable in the table data editor.
Qualifying the object will create as <Schema>.<Name> instead of <database>.<schema>.<name>. The connection already has the <database> assosiated with it and appended the <database> to the object name will cause sap hana to throw errors if its not in a multi-container mode.
Changes required in the following classes to correctly build the binary string:
CoreLibImportThread DataTableModel DSTableWriter ETLUtil ImportExcelImportThread ImportThread
Changes where required in the following classes to correctly build the insert, update & delete statements in the table data editor:
AFBaseDBObject AFTableColumnInitHana
I tested the table data editor, import from file, import from excel and export to file.
for further testing we should create tables with binary types, insert data via table data editor, import and export data, and any other locations that work with the table's data.
We are using the HEXTOBIN(<String>) database function to work with the binary datatype. This was required in order to correctly compare the string in the WHERE Clause. If the user disables the File->Option->Results->Data Retrieval -> [Convert Binary to hex], attempting to modify the binary code using table data editor will fail.
Binary datatype is now modifiable in the table data editor.
Qualifying the object will create as <Schema>.<Name> instead of <database>.<schema>.<name>. The connection already has the <database> assosiated with it and appended the <database> to the object name will cause sap hana to throw errors if its not in a multi-container mode.
Precondition: Check option "Convert Binary to Hex" in File -> Options->Results
Step 1: Create table with Binary and Varbinary datatypes.
Step 2: Insert data into table through Table Data Editor.
Refer : (InsertData.png)
Step 3 : Execute SELECT * query , confirmed data is retrieving correctly.
Step 4: Export data using View As Spreadsheet option.
Refer :(View_As_Spreadsheet.xlsx)
Step 5: Export table data into csv file using Tools -> Export Data option.
Refer : (Export_CSV.csv)
Step 6: Export table data into excel file using Tools -> Export Data option
Refer :(Export_Excel.xlsx)
Step 7: Try to import exported csv file into table using Tools-> Import Data option.
Result : Data imported successfully for all three transaction types.
Refer : (Import_CSV.png)
Step 8: Try to import exported excel file into table using Tools-> Import Data option.
Result : Data imported successfully for all three transaction types.
Refer : (Import_Excel.png)
Step 9: Try to import exported “ViewAsSpreadsheet_excel” file into table using Tools-> Import Data option.
Result : Data imported successfully for all three transaction types.
Refer : (Import_View_As_Spreadsheet.png)
Step 10: Confirm HEXTOBIN(<String>) conversion of the binary datatype.
Refer : Preview_sql.png
Precondition: Check option "Convert Binary to Hex" in File -> Options->Results
Step 1: Create table with Binary and Varbinary datatypes.
Step 2: Insert data into table through Table Data Editor.
Refer : (InsertData.png)
Step 3 : Execute SELECT * query , confirmed data is retrieving correctly.
Step 4: Export data using View As Spreadsheet option.
Refer :(View_As_Spreadsheet.xlsx)
Step 5: Export table data into csv file using Tools -> Export Data option.
Refer : (Export_CSV.csv)
Step 6: Export table data into excel file using Tools -> Export Data option
Refer :(Export_Excel.xlsx)
Step 7: Try to import exported csv file into table using Tools-> Import Data option.
Result : Data imported successfully for all three transaction types.
Refer : (Import_CSV.png)
Step 8: Try to import exported excel file into table using Tools-> Import Data option.
Result : Data imported successfully for all three transaction types.
Refer : (Import_Excel.png)
Step 9: Try to import exported “ViewAsSpreadsheet_excel” file into table using Tools-> Import Data option.
Result : Data imported successfully for all three transaction types.
Refer : (Import_View_As_Spreadsheet.png)
Step 10: Confirm HEXTOBIN(<String>) conversion of the binary datatype.
Refer : Preview_sql.png
Issue #14343 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build v17.0.3-15 |
No time estimate |
1 issue link |
relates to #13646
Issue #13646Insert statement is not generated with right values for Export Data. |
Modification made to the import thread to handle the binary datatype as a string quoted column.
Committed revision: 49096