Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

johanttblom
New Contributor

Working SQL Query giving error when run through Qlik (OLEDB Connect32)

I'm trying to pull in some SAP SQL data through the OLEDB Connect 32 connector, but I'm running into an error when it comes to the Business Partner data table generated through a Left Join containing query. My other tables using the same connector work fine and this Query also works fine when run Microsoft SQL Server Management Studio.

QlikError.JPG

BPMaster:

SQL SELECT OCRD.[GroupCode],

OCRD.[CardCode],

OCRD.[CardName],

OCRD.[SlpCode],

OCRD.[CardType],

OCRG.[GroupCode],

OCRG.[GroupName],

OSLP.[SlpCode],

OSLP.[SlpName]

FROM OCRD

LEFT JOIN OCRG ON OCRD.[GroupCode] = OCRG.[GroupCode]

LEFT JOIN OSLP ON OCRD.[SlpCode] = OSLP.[SlpCode];

1 Solution

Accepted Solutions

Re: Working SQL Query giving error when run through Qlik (OLEDB Connect32)

Use a LOAD statement before doing the SELECT and make sure you get every field only once, and also that the field spelling is case sensitive.

Alternatively, run the three selects separately (OCRD, OCRG and OSLP) and verify that the results are expected.

2 Replies

Re: Working SQL Query giving error when run through Qlik (OLEDB Connect32)

Use a LOAD statement before doing the SELECT and make sure you get every field only once, and also that the field spelling is case sensitive.

Alternatively, run the three selects separately (OCRD, OCRG and OSLP) and verify that the results are expected.

johanttblom
New Contributor

Re: Working SQL Query giving error when run through Qlik (OLEDB Connect32)

mbaeyens Thanks it was due to GroupCode and SlpCode appearing twice.

BPMaster:

SQL SELECT OCRD.[GroupCode] AS 'GrpCode',

   OCRD.[CardCode],

   OCRD.[CardName],

   OCRD.[SlpCode] AS 'SalespCode',

   OCRD.[CardType],

   OCRG.[GroupCode],

   OCRG.[GroupName],

   OSLP.[SlpCode],

   OSLP.[SlpName],

FROM OCRD

LEFT JOIN OCRG ON OCRD.[GroupCode] = OCRG.[GroupCode]

LEFT JOIN OSLP ON OCRD.[SlpCode] = OSLP.[SlpCode];