title: SQL Query all Databases
body: <p>I need the run the following query on many databases, I have over 100+ databases, but I don't want to pull up each database and run the query one at a time. </p>
  
  <p>The User table is only listed in <code>Database#_Account</code>.</p>
  
  <p>If the query is ran it errors out because <code>Database#_Admin</code> does not have <code>User</code> Table.</p>
  
  <p>(EXAMPLE Database List)</p>
  
  <pre><code>Database:
  ---------------------
  MASTER
  Model
  msdb
  tempdb
  Database1_Account
  Database1_Admin
  Database2_Account
  Database2_Admin
  Database3_Account
  Database3_Admin
  </code></pre>
  
  <p>Query: </p>
  
  <pre><code>EXEC sp_MsForEachDb @command1 = SELECT "?" as DatabaseName, * 
                                  FROM ?.User 
                                  WHERE Name = "John" AND "?" LIKE "%_Account"
  </code></pre>