title: Check if parameter is null in CosmosDB query
body: <p>How can I check if a parameter is null in <a href="https://www.npmjs.com/package/@azure/cosmos#query-the-database" rel="nofollow noreferrer">@azure/cosmos sdk</a> when querying the database?</p>
  <p>I've tried the IS_NULL or IS_EMPTY, either breaks the query:</p>
  <pre><code>await container.items
    .query({
      query: `
          SELECT * from company
          WHERE company.location = @location
  
          AND (@dateFrom IS NULL OR company.createdAt &gt;= @dateFrom)
          AND (@dateTo IS NULL OR company.createdAt &lt; @dateTo)
  
          ORDER BY company.createdAt DESC
      `,
      parameters: [
          { name: &quot;@location&quot;, value: &quot;Germany&quot; },
          { name: &quot;@dateFrom&quot;, value: new Date().setFullYear(new Date().getFullYear() - 5)},
          { name: &quot;@dateTo&quot;, value: new Date() },
      ]
    })
    .fetchAll();
  </code></pre>
  <p>I'm getting this error:</p>
  <pre><code>Message: {\&quot;errors\&quot;:[{\&quot;severity\&quot;:\&quot;Error\&quot;,\&quot;location\&quot;:{\&quot;start\&quot;:243,\&quot;end\&quot;:245},\&quot;code\&quot;:\&quot;SC1001\&quot;,\&quot;message\&quot;:\&quot;Syntax error, incorrect syntax near 'IS'.\&quot;}]}
  </code></pre>