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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Stored Procedure

Hi guys,

I am trying to execute a stored procedure with a variable.  I've created the variable and loaded the script. 

Load * ;

SQL EXECUTE sp_CustomerPriceList '$(vCustNo)';

After the load has completed successfully i cannot see any fields to choose when creating a table within my sheet based on the results of the stored procedure.

Has anyone seen anything like this before?  Or can offer any advice?

Thanks

14 Replies
maxgro
MVP
MVP

yes,

example I have this for test a stor proc in Qlik and SqlServer (and it works)

Qlik

T:

load *;

sql execute sp_test '%MED%';

Sql Server

ALTER PROCEDURE [dbo].[sp_test]

  @p_banca varchar(10)

AS

BEGIN

  SET NOCOUNT ON;

  SELECT * from d001_banche where des_banca like @p_banca;

END

maxgro
MVP
MVP

and this also works, with a variable

set var='%E%';

T:

load *;

sql execute sp_test '$(var)';

Anonymous
Not applicable
Author

I wonder if it is because i am using a temp table within the stored procedure?

Should I try and remove that and create the table instead?

Not applicable
Author

Hi,

Are you facing any errors?

Please check if you have duplicate field names ....most of the time script fails due to field name duplication...

Check log file for more information....

Not applicable
Author

You could try naming the i,e when you call it use something like  dbo.sp_test1

Anonymous
Not applicable
Author

I am getting there!  I just needed to select the results of the table within the load script. 

What i am trying to achieve i don't think is possible.  I have a variable within my sheet which is called VCustNo and the user can enter a customer number in here.  What i would like to happen is for the stored procedure to execute after a customer number is entered...

Does this make sense?

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Well, in QV Country this doesn't make that much sense. On average, you'll be loading all customer information straight into your QV document, upon which the user simply points to a CustomerNo and gets results immediately. Withtout rerunning the script every time new data is needed.

If the data is massive, you could try DIRECT DISCOVERY to get the details interactively, once your user has decided on a customer to focus on.

Peter

Anonymous
Not applicable
Author

Just thinking aloud !

Could I create a button to execute the stored procedure?

maxgro
MVP
MVP

You can use an input box to get the customer from the user and a button to trigger a reload (with an action)

This works for Qlik desktop.

In server I think you have to use EDX or something else.

But I strongly agree with Peter, this doesn't make that much sense.