title: Running Sql Server stored proc in context of caller
body: <p>This is making me nuts and I'm sure the answer is SO easy.</p>
  
  <p>I have multiple schemas that each have a view named "Task".  I want to make a single stored proc that users running in multiple default schemas can execute successfully -- that stored proc does a select on the Task view.</p>
  
  <p>So say I have these objects:</p>
  
  <p>View: fr.Task (users with default schema of 'fr' get this if they just type "select * from Task"
  View: de.Task (ditto, but for users with default schema of 'de')</p>
  
  <p>StoredProc: dbo.MyProc -- all users have execute permissions.  The proc is simply:</p>
  
  <pre><code>select count(*) from Task 
  </code></pre>
  
  <p>Now I would expect (and I want) that if a user with default schema 'fr' did </p>
  
  <pre><code>exec dbo.MyProc
  </code></pre>
  
  <p>Then they would get the count of rows from view fr.Task.  But instead they get error "Invalid object name 'Task'."</p>
  
  <p>Is it not possible to make a generic storedproc that will execute a select in the schema of the running user?</p>
  
  <p>Thx,
  Bill</p>