u sql - Create a View with the identifier as a variable on u-sql -


i create view using u-sql. name of view can defined @ compile time using declare function.

visual studio throws syntax error when try use variable in create view statement.

is there workaround this?

u-sql not support dynamic u-sql @ point although if feel important missing feature post feature request here:

https://feedback.azure.com/forums/327234-data-lake

it looks there similar request can vote here.

as workaround, generate u-sql dynamically run script separately either manually or using 1 of sdks eg using powershell, .net. simple example:

//dynamic u-sql declare @viewname string = "dbo.vw_yourviewname";  // create dynamic u-sql @usql =          select *          ( values             ( "use database yourdatabase;"),             ( string.format("drop view if exists {0};", @viewname)),             ( string.format("create view if not exists {0} extract col1 int, col2 string, col3 string, col4 string, col5 string \"/input/input44.txt\" using extractors.csv();", @viewname))              )  x (usql);   // output statements in correct sort order output @usql "/output/dynamic.usql"  using outputters.text(delimiter:' ', quoting:false); 

other examples of dynamic u-sql (or more precisely, u-sql generated dynamically) here , here.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -