title: How to use system variable @@dataset_id in BigQuery view
body: <p>BigQuery has session-bound (or script-bound) system variables, described <a href="https://cloud.google.com/bigquery/docs/reference/system-variables" rel="nofollow noreferrer">here</a>. Within a session, I can declare the value of one of those variables, e.g. with something like:</p>
  <pre><code>set @@dataset_id = 'my_dataset_id';
  </code></pre>
  <p>Now, I'd like to have a view (which I plan on running within a session) that includes something like:</p>
  <pre><code>create view foo
  as
  select ...
  from @@dataset_id.my_table
  </code></pre>
  <p>... this doesn't work. Nor does any form of quoting around that variable. It appears use of that variable simply isn't allowed to help identify the namespace of <code>my_table</code>.</p>
  <p>If that's true, I'm struggling to see the value of that variable at all. Does anyone know if I can use those variables as so, or how to prevent needing to namespace-bound all instances of <code>my_table</code>? I'd like to manage these query scripts outside of BQ itself, and ideally without templating in everywhere (e.g. <code>{dataset_id}.my_table</code>)</p>