0

If I use an Alias in U-SQL the intellisense doesn't prompt me for anything. For example,

@query =
  SELECT PropertyOne,
         PropertyTwo
  FROM @some_table;

@intellisense_test =
  SELECT PropertyOne
    FROM @query;

In this case the intellisense will work. But in the example below it will not.

@intellisense_test = 
  SELECT q.PropertyOne 
    FROM @query AS q;

This creates a problem when doing anything but simple queries. Does anyone know a work around for this?

2 Answers2

0

This is the typical "SQL" problem for intellisense. Since the intellisense parser is only able to use the bindings already seen, it does not know in the SELECT clause what the FROM clause contains. I asked them to check if there is a way to look ahead to the FROM clause in the SELECT case, but for now unfortunately it does not.

Michael Rys
  • 6,684
  • 15
  • 23
0

I found a work around to this when I had several joins in my FROM clause.

If you write the alias immediately followed by a square bracket intellisense returns the field list from the alias table.

For example:

@intellisense_test = 
  SELECT q[PropertyOne]
FROM @query AS q;

This works when writing the statement and is handy for speed of typing. However, you will need to go back and add the dots between alias and field or you'll get a compile error. This is also easily done when doing a vertical highlight with the mouse by holding the ALT key.

Not perfect, but it's a valid work around.

Hope this helps.

Paul Andrew
  • 3,233
  • 2
  • 17
  • 37