I wonder how to make simple query like this in Cosmos Db: SELECT c.pk as pk1, * FROM c

Viewed 166

I wonder if it's possible to select a field under some alias and all the rest fields in a single query.

This query works: SELECT * FROM c

and this query works: SELECT c.pk as pk1 FROM c

But this one does not: SELECT c.pk as pk1, * FROM c

Error: "One of the input values is invalid."

The expected result is same field 'pk' appears twice in the output: as 'pk' and 'pk1'. It's needed to circumvent current limitation of Azure Data Factory to prevent mapping the same field twice in "Copy Data" activity.

I need "all the rest" without listing them all, so with new fields added I do not have to update the query.

1 Answers

Try embedding within []

SELECT ["c.id"] as pk1, ["c.*"] FROM c
Related