Re: Database Engine Tuning Advisor suggestion to replace syntax.

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks, Erland - RLF

"Erland Sommarskog" <esquel@xxxxxxxxxxxxx> wrote in message
news:Xns9B0A7496817BYazorman@xxxxxxxxxxxx
Russell Fields (RussellFields@xxxxxxxxxx) writes:
If that is true, Mike's code would benefit from reuse, but only if he
fully specified the table name. (Because the Books Online also comment
"If object names in the statement string are not fully qualified, the
execution plan is not reused.")

Which is not fully correct. The plan is reused, if the next guy has the
same default schema. But best practice is to use two-part notation with
sp_executesql.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000:
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx



.



Relevant Pages

  • Re: query performance help needed
    ... I created a SP that by using dynamic sql access SP in all databases ... The stored procedure in other databases is very simple couple of joins ... Not really sure what you mean when you say "the execution plan is ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)
  • Re: Ad-hoc/Dynamic SQL Performance
    ... that, on the same hardware, Oracle 10 is about 20% slower than SQL Server. ... execution plan and bind that execution plan with the COBOL program. ...
    (comp.databases.oracle.server)
  • Re: query performance help needed
    ... Whether the execution plan is there or not has little do with it. ... It's very clear that you need to analyse your query plans, ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: user wants access
    ... I would strongly recommend you read Books Online for this information. ... the db_securityadmin fixed database role. ... Looking for a SQL Server replication book? ...
    (microsoft.public.sqlserver.server)
  • Re: Database Engine Tuning Advisor suggestion to replace syntax.
    ... What you said was what I first planned to say, but then I read the Books Online which implies that the batch is indeed reused, so I held back from saying that. ... the query optimizer will probably match the Transact-SQL statement in the second execution with the execution plan generated for the first execution. ... SQL Server does not have to compile the second statement." ...
    (microsoft.public.sqlserver.tools)