title: Can I set a default schema for within a stored procedure?
body: <p>I'm working on the next update for StackQL.</p>
  
  <p>One thing I want to do is have the ability to query over several releases.  So when I loaded the October data, for example, I didn't delete the old September database.  It's still out there.  In fact, you can even still query it by including the database name like this:</p>
  
  <pre><code>select top 10 * from SO_Sept09..Posts
  </code></pre>
  
  <p>This will be even more important as they start providing data for ServerFault and SuperUser.</p>
  
  <p>But I don't like having a whole bunch of databases out there to support this.  I'd much rather put all the data in the same database and separate each distinct set into it's own schema.  But to make this possible, I need to be able to set a default schema as part of the stored procedure that runs the query, based on a parameter passed to the stored procedure that tells it which database the user selected from a future drop down list to appear in the tool bar.  </p>
  
  <p>Queries at StackQL are eventually just passed to the <code>exec()</code> function like this:</p>
  
  <pre><code>exec(@QueryText)
  </code></pre>
  
  <p>Is there anything I can do either in the stored procedure or prepend to the QueryText string (ala <code>USE [DatabaseName]</code>) to set the default schema used in a query?</p>