Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

extracting field with parentheses

Hi everybody,

I'm extracting a field from database with the name   Cost Amount (Actual)  but it gives me an error in script,

here is my query

SELECT  [Cost Amount (Actual)] as prix

      FROM [EKG2013].[dbo].[FAD2014$Item Ledger Entry];

regards.

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

There are many things that may have gone wrong here. But first - if it says that the field name is incorrect, then it is incorrect. So...

One possibility is that you have written the field name with soft blank spaces - char(32) - but it is in fact defined using hard blank spaces - char(160). Another possibility is that the library name is incorrect.

Either way, I would try to load SELECT * FROM ... to see which fields I get.

HIC

View solution in original post

11 Replies
giakoum
Partner - Master II
Partner - Master II

is it an oracle db?

SQL SELECT  "Cost Amount (Actual)" as prix

      FROM [EKG2013].[dbo].[FAD2014$Item Ledger Entry];

Not applicable
Author

no loannis it's an sqlserver database

hic
Former Employee
Former Employee

The SELECT statement is not evaluated by QlikView. It is evaluated by the ODBC driver or OLEDB provider. So, without the error message it is impossible to say what has gone wrong. Perhaps try using double quotes:

SELECT  "Cost Amount (Actual)" as prix

      FROM [EKG2013].[dbo].[FAD2014$Item Ledger Entry];

HIC

giakoum
Partner - Master II
Partner - Master II

it should work for mssql as well. If you try to select a field with no spaces, does it work?

Not applicable
Author

no either mr henric , it tells me that the field name is incorrect

and for information i use [] and it works for the other queries for fields without parentheses.

Not applicable
Author

no it deosn't 😕

Not applicable
Author

Try using precedent load, something like this:

LOAD

     "Cost Amount (Actual)";

SQL SELECT *

FROM [EKG2013].[dbo].[FAD2014$Item Ledger Entry];

hic
Former Employee
Former Employee

There are many things that may have gone wrong here. But first - if it says that the field name is incorrect, then it is incorrect. So...

One possibility is that you have written the field name with soft blank spaces - char(32) - but it is in fact defined using hard blank spaces - char(160). Another possibility is that the library name is incorrect.

Either way, I would try to load SELECT * FROM ... to see which fields I get.

HIC

Not applicable
Author

As Henric and Ioannis, I would have said the double quotes. Double quote and square brackets ? SELECT "[ Your field (xxx)]" as Prix ?

If you are stuck, create a View in SQL Sever with the good name and use it from QlikView

Fabrice