why simple param not working for below queries...
DBCC FREEPROCCACHE;
GO
SELECT [id],[descr] FROM [dbo].[t1] WHERE id=1;
GO
SELECT [id],[descr] FROM [dbo].[t1] WHERE id=2;
GO
SELECT usecounts, cacheobjtype, objtype, [text], p.size_in_bytes as [size]
FROM sys.dm_exec_cached_plans P
CROSS APPLY sys.dm_exec_sql_text(plan_handle)
WHERE --cacheobjtype like 'Compiled Plan%' AND
[text] NOT LIKE '%dm_exec_cached_plans%';
--output
======
usecounts cacheobjtype objtype text size
1 Compiled Plan Adhoc SELECT [id],[descr] FROM [dbo].[t1] WHERE id=2; 24576
1 Compiled Plan Adhoc SELECT [id],[descr] FROM [dbo].[t1] WHERE id=1; 24576
text of
Name
Owner
Type Created_datetime
-------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------
------------------------------- -----------------------
t1
dbo
user table 2012-10-15 00:30:35.817
Column_name
Type
Computed Length Prec Scale Nullable
TrimTrailingBlanks FixedLenNullInSource Collation
-------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------
----------------------------------- ----------- ----- ----- ----------------------------------- ----------------------------------- ----------------------------------- --------------------------------------------------------------------------------------------------------------------------------
id
int
no 4
10 0 yes (n/a)
(n/a) NULL
descr
varchar
no 200
yes no
yes Latin1_General_CI_AI
Identity
Seed Increment
Not For Replication
-------------------------------------------------------------------------------------------------------------------------------- --------------------------------------- --------------------------------------- -------------------
No identity column defined.
NULL NULL
NULL
RowGuidCol
--------------------------------------------------------------------------------------------------------------------------------
No rowguidcol column defined.
Data_located_on_filegroup
--------------------------------------------------------------------------------------------------------------------------------
ps1
index_name
index_description
index_keys
-------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
i1
nonclustered located on ps1
id
No constraints are defined on object 't1', or you do not have permissions.
No foreign keys reference table 't1', or you do not have permissions on referencing tables.
No views with schema binding reference table 't1'.
Manish