1

I have been trying to create unit tests for one of the stored procedures in my database using tSQLt and facing one issue,

Query processor could not produce a query plan because of the hints defined in this query. Resubmit the query without specifying any hints and without using SET FORCEPLAN.[16,1]{spPlaceNewOrder,56} (There was also a ROLLBACK ERROR --> The current transaction cannot be committed and cannot be rolled back to a savepoint. Roll back the entire transaction.{Private_RunTest,161})

Can someone please help me on this?

  • 1) Show your query 2) Remove/comment hint `-- OPTION ()` – Lukasz Szozda Dec 24 '15 at 11:47
  • 1
    It is not clear from your question whether the issue relates to the query hint or the "There was alas a rollback error" message. If the latter, tSQLt runs every unit test in it's own transaction so if that transaction was forcibly rollback (in your code or otherwise) then you will see this error. To isolate to problem area, try commenting out the hint and re-run your test. – datacentricity Dec 29 '15 at 09:37
  • @datacentricity What if i want the hints to remain in the stored procedures? Can i not work with the hints ON in tSQLt tests. – Vighneshwar Madas Dec 29 '15 at 09:56
  • 1
    The idea behind commenting out the hints is to isolate whether the problem is with the hint or the test (as a temporary investigative step). One thing to consider is that if you are using FakeTable, any underlying indexes will not be applied to the mock table used for the test. As you still haven't provided any code it is very difficult to help you further. – datacentricity Jan 03 '16 at 15:21

0 Answers0