none
Declare table name as a parameter in USQL

    Question

  • I would like to specify the table I want to read/write from as a parameter, so that I can set it from my Data factory pipeline. How could I achieve this?

    I have tried the following, which fails with the error "Rowset variable @InputTable was not found."

    DECLARE @outputlocation string = "/outputlocation.txt";    DECLARE @InputTable string = "master.dbo.mytable";   
    
    @input = 
    SELECT col1, col2, col3
    FROM @InputTable;
    
    OUTPUT @input
    TO @outputlocation
    USING Outputters.Csv();



                     
    Friday, March 4, 2016 4:14 PM

Answers

  • Dear Hugh

    Like most SQL dialects, U-SQL currently does not provide parameterization of table names.

    Please go to http://aka.ms/adlfeedback and suggest this as a feature.

    Until then, you would have to use your own parameterization, e.g. via a shell script using one of the SDKs (Powershell or node.js) where you string replace the table name before submitting the script.


    Michael Rys

    Friday, March 4, 2016 6:30 PM
    Moderator