Advertisement
Guest User

Untitled

a guest
Jan 21st, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.95 KB | None | 0 0
  1. /****** Object:  Table [dbo].[macVendor]    Script Date: 22/01/2014 2:57:36 PM ******/
  2. SET ANSI_NULLS ON
  3. GO
  4.  
  5. SET QUOTED_IDENTIFIER ON
  6. GO
  7.  
  8. CREATE TABLE [dbo].[macVendor](
  9.     [companyId] [nvarchar](50) NOT NULL,
  10.     [organization] [nvarchar](200) NULL,
  11. PRIMARY KEY CLUSTERED
  12. (
  13.     [companyId] ASC
  14. )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
  15. ) ON [PRIMARY]
  16.  
  17.  
  18. /*** view cached query plans and text */
  19. GO
  20. SELECT TOP 100
  21.     cp.objtype,
  22.     OBJECT_NAME(st.objectid,st.dbid) AS ObjectName,
  23.     cp.usecounts,
  24.     cp.size_in_bytes,
  25.     st.dbid,
  26.     st.objectid,
  27.     st.NUMBER,
  28.     st.encrypted,
  29.     st.text,
  30.     qp.dbid,
  31.     qp.objectid,
  32.     qp.NUMBER,
  33.     qp.encrypted,
  34.     qp.query_plan
  35.  
  36. FROM sys.dm_exec_cached_plans AS cp
  37. CROSS APPLY sys.dm_exec_query_plan(cp.plan_handle) AS qp
  38. CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) AS st
  39. WHERE  text LIKE '%macVendor%'
  40. ORDER BY cp.usecounts DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement