title: What's the quickest validation query from a jdbc-pool to a specific table in SQL Server 2008
body: <p>I usually use <code>SELECT 1</code> as my preferred validation-query from tomcat jdbc pools, because it returns only one row with the result <strong>1</strong> that is very faster, but today I've found one terrible mistake:</p>
  
  <p>My database <strong>only</strong> has <strong>one table</strong> with its <strong>primary key</strong> and is <strong>not nullable</strong>. This table sometimes is dropped, and then appears again by application circumstances. And that's the problem, <code>SELECT 1</code> validate connection to database because it's already up but the table is missing so  I get a terrible exception.</p>
  
  <p>So, the solutions passes by finding one validation-query against the only table that exists in the database. And also, I need the query to be as fast as possible, because the performance in the application is one of the main objetives.</p>
  
  <p>You can answer than an obvius query may be <code>SELECT 1 FROM THE_TABLE</code> but this query returns <strong>1</strong> for each row that the table has, and that's not very quick.</p>
  
  <p>So, <strong>what could be the faster validation-query to this table??</strong></p>
  
  <p><em>EDIT</em></p>
  
  <p>If I need to return <em>at least one result</em>, <strong>How should be the validation-query?</strong><br>
  I ask this because some pool implementations, like commons-dbcp doesn't accept a query without results as a validated query.</p>