Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stored Procedure

Hi,

I want to load data from stored procedure into qlikview.

the SP gets an input (date) and returns AgencyId and HotelId.

I created an ODBC connection and then:

SP:

sql

DECLARE @d date = getdate()-1

EXEC sp_WhiteDots @d;

the sql script works in Microsoft SQL server.

but there are no results in qlikview (no errors either).

i also tried :

load AgencyId, HotelId;

sql

DECLARE @d date = getdate()-1

EXEC sp_WhiteDots @d;

but then i got this error :

Field not found - <AgencyId>

sql

DECLARE @d date = getdate()-1

EXEC sp_WhiteDots @d

help please!

Labels (1)
4 Replies
marcus_sommer
MVP
MVP

You could only use these functions and syntax within your sql-statement which the database and the odbc-driver support. I would it try something easier like:

Load *;

SQL SELECT YourFields From YourProcedure;

- Marcus

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

I would suggest create a QlikView variable to hold DECLARE @d date = getdate()-1 and pass the variable into your SQL

EXEC sp_WhiteDots @d.

Hope this help

maxgro
MVP
MVP

let var= date(today()-1, 'YYYYMMDD');

trace var=$(var);

T:

load *;

sql execute sp_WhiteDots '$(var)';

sinanozdemir
Specialist III
Specialist III

Please see the below script:

Capture.PNG

As you can see I created a variable called vParam which is equivalent of GETDATE() - 1. Although, pay attention to the date format 'YYYY-MM-DD', this is SQL Server default date format.

The original table had the below data:

Capture3.PNG

After I ran the QV script, I got the below results which gave every record that didn't have today's date:

Capture2.PNG

And here is my stored procedure for this exercise:

Capture4.PNG

hope this helps.