title: Dynamic Database Name for T-SQL statement FROM clause
body: <p>I have several databases which contains the same table name and structure. I need to be able to execute a simple T-SQL which will run against each one and I would like to have the database name in the <code>FROM</code> clause populated using a variable. Can I do that or is there a better method?</p>
  
  <p>Here is an example of code which will not work but should exemplify what I am trying to do.</p>
  
  <pre><code>DECLARE @dbn sysname;
  
  SET @dbn = 'EDIT'
  
  select sde_id, owner, direct_connect, nodename + ':' + sysname "nodename:sysname", start_time
    FROM **[@dbn]**.[SDE].[SDE_process_information]
  </code></pre>