Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
and this also works, with a variable
set var='%E%';
T:
load *;
sql execute sp_test '$(var)';
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?
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....
You could try naming the i,e when you call it use something like dbo.sp_test1
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?
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
Just thinking aloud !
Could I create a button to execute the stored procedure?
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.