title: PetaPoco stored procedure error "Incorrect syntax near the keyword 'FROM'."}
body: <p>I'm using C# with TSQL and SQL Server 2005</p>
  
  <p>I'm trying to use PetaPoco to return a dataset as a list of objects.  this is the code I'm using just now</p>
  
  <pre><code>var s = PetaPoco.Sql.Builder.Append("USE [BI] EXEC [dbo].[TestProcedure2];");
              var result =  db.Query&lt;dynamic&gt;(s);
  
  var result2 = db.Query&lt;dynamic&gt;("USE [BI] EXEC [dbo].[TestProcedure2];");
  </code></pre>
  
  <p>I think the error message is a generic sql error for when petaPoco fails.</p>
  
  <p>At first I was using a stored procedure with paramaters and the @ character was causing a problem, once that was fixed with @@ i started getting this error so I made a stored procedure with a simple select statement.  The procedure executes completely fine in Management Studio.  </p>
  
  <p>Using PetaPoco with select statements is fine and the data is mapped both to a dynamic or an object model completely fine.  I created a garbage SQL string and it returned the same error which is where I'm getting the generic error idea from.  </p>
  
  <p>This is the select I'm using which works fine</p>
  
  <pre><code>var dynTest =
                  db.Query&lt;dynamic&gt;(
                     "SELECT TOP 10 * FROM [BI].[dbo].[Managers] ORDER  BY [ConsecutiveDays] desc");
  </code></pre>