If i have sql statement(which is inside dynamic sql) like this:
DECLARE @myId int
SET @myId=(SELECT TOP 1 myId FROM myTable WHERE myName='myName')
The plan for this query is always cached, I have checked.
How can I add hint OPTION (RECOMPILE) to this statement to prevent caching?
I have tried everything and it won't work:
br, Simon