Difference between SET OPTIONS PARSEONLY and NOEXEC


hi,

can tell me difference between parsing , compling query. 

the parseonly parse query syntax(my understanding) example:(msdn link - > http://technet.microsoft.com/en-us/library/ms178629.aspx)

set parseonly on  go  select * table1  go  set parseonly off  go

and option noexec complies query. getting same result. (msdn link -> http://technet.microsoft.com/en-us/library/ms188394.aspx)

example: 

set noexec on  go  select * table1  go  set noexec off  go

does compliation not found object not found error?

what difference between above 2 options?


regards harsh

harsha,

i getting explained. may executing whole script single shot. may add "go" between statements.

create table test_planforharsha(col1 int) insert test_planforharsha select 1 go set noexec on go select * test_planforharsha go set noexec off go --check caching select '2' roundnum, usecounts, cacheobjtype, objtype, text  sys.dm_exec_cached_plans  cross apply sys.dm_exec_sql_text(plan_handle)  usecounts > 0 ,          text '%select * test_planforharsha%'     , text not '%check%' order usecounts desc; go --yes, can see plan created above table exists.  --lets non existence object set noexec on go select * test_planforharsha1 go set noexec off go --check caching select '2' roundnum, usecounts, cacheobjtype, objtype, text  sys.dm_exec_cached_plans  cross apply sys.dm_exec_sql_text(plan_handle)  usecounts > 0 ,          text '%select * test_planforharsha1%'     , text not '%check%' order usecounts desc; --you can not see plan object not exists, not throw error.
sample result



SQL Server  >  Getting started with SQL Server



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........