Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically passing Table name as parameter in Stored Procedure in U-SQL #128

Open
HermeetB opened this issue Apr 10, 2018 · 1 comment
Open

Comments

@HermeetB
Copy link

HermeetB commented Apr 10, 2018

I want to pass the Table name as in-parameter in a stored procedure in U-SQL and then want to have a SELECT * FROM the table. Something like below ::

USE DATABASE ADLDEMO;

CREATE PROCEDURE IF NOT EXISTS sp_demo
(@TargetTableName string)
AS
BEGIN;

@A=
SELECT * FROM @TargetTableName;

OUTPUT @A
TO "/ADL-Demo/viewmultiple.csv"
USING Outputters.Csv(outputHeader:true);

END;

but this is giving me error like "Rowset variable @TargetTableName was not found in the procedure 'sp_demo'."

can anyone please help on how to do select * from a table passed as in-parameter?

@MikeRys
Copy link
Collaborator

MikeRys commented Apr 10, 2018

Hi Hermeet

U-SQL (like any other SQL dialect) currently does not support table name parameterizations.

The current workaround is to generate the script either via PowerShell, T4, or another U-SQL Script (depending on how you get the parameter values and what your preferred workflow is), and then submit that generated script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants