Fix the SC2001 Identifier Could Not Be Resolved Error in Cosmos DB

When writing SQL queries to test them against your CosmosDB collections, you might encounter the following error message:

SC2001: Identifier XXX could not be resolved.

Here, XXX is the name of a property inside your collection. For example, consider the following query:

SELECT * FROM students WHERE firstname = 'Christos'

The reason for the error is that you forgot to include the name of the collection or the alias name for each property you use. Here are the correct examples:

SELECT * FROM students WHERE students.firstname = 'Christos'

Using an alias for the name of the collection:

SELECT * FROM students AS s WHERE s.firstname = 'Christos'

comments powered by Disqus