Guest User

Untitled

a guest
Apr 25th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. create function foo (@a int)
  2. returns int
  3. as
  4. begin
  5. return @a
  6. end
  7.  
  8. -- clear out the plan cache
  9. dbcc freeproccache
  10. dbcc dropcleanbuffers
  11. go
  12.  
  13. -- use the function
  14. select dbo.foo(5)
  15. go
  16.  
  17. -- inspect the plan cache
  18. select * from sys.dm_exec_cached_plans
  19. go
  20.  
  21. select * from sys.dm_exec_query_plan(<insertplanhandlehere>)
  22.  
  23. CREATE FUNC dbo.Foo ()
  24. RETURNS TABLE
  25. AS
  26. RETURN (SELECT ...)
  27. GO
Add Comment
Please, Sign In to add comment