Solved

sp_executesql. any advantages of using this in my select statement?

Posted on 2007-12-06
2
249 Views
Last Modified: 2008-02-01
i wonder is there any performance gain if my select statement start with sp_executesql? in term of execution plan will I have any advamtages by using this sp?
0
Comment
Question by:motioneye
2 Comments
 
LVL 27

Assisted Solution

by:ptjcb
ptjcb earned 150 total points
ID: 20420263
Without knowing your sql select statement it is hard to know.

FROM http://msdn2.microsoft.com/en-us/library/ms188001.aspx

Being able to substitute parameters in sp_executesql offers the following advantages to using the EXECUTE statement to execute a string:

    * Because the actual text of the Transact-SQL statement in the sp_executesql string does not change between executions, the query optimizer will probably match the Transact-SQL statement in the second execution with the execution plan generated for the first execution. Therefore, SQL Server does not have to compile the second statement.
    * The Transact-SQL string is built only one time.
    * The integer parameter is specified in its native format. Casting to Unicode is not required.
0
 
LVL 31

Accepted Solution

by:
James Murrell earned 350 total points
ID: 20420395
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question