Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Stored procedure results & aliases

Hi everyone,

I can call a stored procedure in MSSQL 2012 from QV. No worries there. My SP returns a table. Yeah, got it, I can see it in QV.

The call is as simple as:

SQL EXECUTE [SP_NAME] @year=2013;

The table returned is defined like this in the SP:

DECLARE @myTable table (id int, serialNumber varchar(20), type int, weekNumber int, new int);

But I would actually like to give aliases to the columns returned from the SP, just like when loading data using a simple SQL select or load from Excel.

Is there a way to do this from within Qlikview or is the only solution to extend the signature of the SP by providing names for the resulting columns so that the call becomes like this:

SQL EXECUTE [SP_NAME] @year=2013, @name1='name1', @name2='name2', @name3='name3' (etc);

Thanks a lot!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Use a preceding load:

LOAD id as ID, serialNumber as SerialNo, type as Type, weekNumber as WeekNo, new as IsNew;

SQL EXECUTE [SP_NAME] @year=2013, @name1='name1', @name2='name2', @name3='name3' (etc);


The result of the sql statement is piped into the preceding load where you can process the data further.


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Use a preceding load:

LOAD id as ID, serialNumber as SerialNo, type as Type, weekNumber as WeekNo, new as IsNew;

SQL EXECUTE [SP_NAME] @year=2013, @name1='name1', @name2='name2', @name3='name3' (etc);


The result of the sql statement is piped into the preceding load where you can process the data further.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks, I did not try this permutation ... it works just as I want it to!