Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
user8
Contributor III
Contributor III

Load data error

Hi,

I'm using MS SQL DB and wanted to load data from a DB view.

 

LOAD [Ref No], 
Comment, 
Function;

[vwTable]:
SELECT "Ref No", 
Comment,
Function 
FROM vwTable;

 

It gave an error as below:

Started loading data
The following error occurred:
Connector reply error: SQL##f - SqlState: 42000, ErrorCode: 156, ErrorMsg: Incorrect syntax near the keyword 'Function'.,
The error occurred here:
?
Data has not been loaded. Please correct the error and try loading again.

If I remove the "Function" column from query, it is able to load successfully.  The "Function" column contains alphabet characters and some Null values.

What could be the cause?

Thank you.

Labels (1)
1 Solution

Accepted Solutions
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

The error shows "function" is a keyword:

Incorrect syntax near the keyword 'Function'.

You need to add "" so that system knows that it is a column, not a keyword in the system.

View solution in original post

11 Replies
Anil_Babu_Samineni

What is this "vwTable"?

[vwTable]:
LOAD [Ref No], 
Comment, 
Function;
SELECT "Ref No", 
Comment,
Function 
FROM vwTable;

 try as per above 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
user8
Contributor III
Contributor III
Author

"vwTable" is a DB view which I'm loading the data from. Same error when I put [vwTable]: at the top of the script.

I'm not modifying the data from the DB view, just connecting to DB, selecting all columns and loading them to Qlik using the standard Data load editor.

Qlik1_User1
Specialist
Specialist

try like this

[vwTable]:

LOAD [Ref No],
Comment,
Function;


SQL SELECT "Ref No",
Comment,
Function
FROM vwTable;

user8
Contributor III
Contributor III
Author

Yes also tried putting [vwTable] at the top of the script but same error.

Qlik1_User1
Specialist
Specialist

try to rename column name "Function" in your view to something else and than try.

user8
Contributor III
Contributor III
Author

Is the "Function" column name causing any conflict in Qlik?

When I query the same 3 columns ("Ref No", Comment & Function) directly on  SQL DB level, I'm able to see the output so not sure why Qlik is complaining about the error.

Anil_Babu_Samineni

Is that simple SQL query working firstly?

SQL SELECT "Ref No",
Comment,
Function
FROM vwTable;

If so, Try to use something like this?

Load *;

SQL SELECT "Ref No",
Comment,
Function
FROM vwTable;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
user8
Contributor III
Contributor III
Author

The SQL query is working fine when I run it in DB level. Tried below but same error:

[vwTable]:

Load *;

SQL SELECT "Ref No",
Comment,
Function
FROM vwTable;

 

 

Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Maybe try:

LOAD [Ref No], 
Comment, 
[Function];

[vwTable]:
SELECT "Ref No", 
Comment,
"Function" 
FROM vwTable;