Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Input Data - SQL Server Stored Procedure With Dynamic Queries - No Columns Returned

nmotikane
5 - Atom

Hi All,

 

We have a very complicated Stored Procedure that has quite a few Dynamic Queries. We are having a tough time trying to successfully bring data into Alteryx calling this stored procedure.

 

If someone can help solve this issue, with below Stored Procedure as an example, it will be greatly appreciated.

 

CREATE PROCEDURE ProcedureWithDynamicQuery
AS
BEGIN
DECLARE @SelectStatement NVARCHAR(2000)

SET @SelectStatement = 'SELECT GETDATE() '

EXECUTE (@SelectStatement)
END

 

Thanks

4 REPLIES 4
GavinAttard
11 - Bolide

Hi

 

If i understood your challenge correctly, one way of doing this sort of thing is using the in-db tools. 

 

dynamic query input.JPG

Alteryx Everything, Leave no one behind.
nmotikane
5 - Atom

Gavin,

 

Will give it a try and get back. Appreciate your input.

 

Regards,

 

Nanda Motikane

ScottG
Alteryx Alumni (Retired)

I think you want to set NOCOUNT on and then, most importantly, use the WITH RESULTS SETS clause to specify the metadata of the resultset.  Alteryx should then have all it needs.

 

CREATE PROCEDURE ProcedureWithDynamicQuery

AS
BEGIN
SET NOCOUNT ON;
DECLARE @SelectStatement NVARCHAR(2000)
SET @SelectStatement = 'SELECT GETDATE() AS DT'
EXECUTE (@SelectStatement) WITH RESULT SETS ((DT DATE))
END

GO

 

 

Scott Gurney
Strategic Sales Engineer
Alteryx, Inc.
nmotikane
5 - Atom

Gavin,

 

We tried. Could not get it to work with In-Db Tools. Appreciate the help.

 

Scott,

 

Your suggestion worked. Appreciate the help.

 

Regards,

 

Nanda Motikane

Labels