Thursday, November 5, 2015
No Comments Yet!!!
Writing and Executing Dynamic Query in SQL Server example
Database: I am making use of Microsoft Northwind database,
CREATE PROCEDURE Customers_GetCustomer
DECLARE @SQL NVARCHAR(2000)
SET @SQL = 'SELECT ContactName FROM Customers WHERE CustomerId = @CustomerId'
EXEC sp_executesql @SQL, N'@CustomerId CHAR(5)', @CustomerId = @CustId
if you have some suggestion, question, request on
Writing and Executing Dynamic Query in SQL Server example.
Please use the comment box to express your views.
Disclaimer: The code samples and API available at www.sourcecodehub.com are available
absolutely free. You are free to use it for commercial as well as non-commercial
use at your own risk, but you cannot use it for posting on blogs or other tutorial
websites similar to www.SourceCodeHub.com without giving reference link to the original
article. All the code samples and API provided by the authors are solely their creation
and neither the author nor the site are responsible if it does not work as intended.